Skip to content

Commit

Permalink
Merge Windows 7/8.1/10 rules
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Jun 2, 2018
1 parent b5a16b8 commit c9e2824
Show file tree
Hide file tree
Showing 97 changed files with 832 additions and 4,623 deletions.
Binary file added .res/paypal-donate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions .res/paypal.svg

This file was deleted.

12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
<a href="https://github.com/crazy-max/WindowsSpyBlocker/releases/latest"><img src="https://img.shields.io/github/release/crazy-max/WindowsSpyBlocker.svg?style=flat-square" alt="GitHub release"></a>
<a href="https://github.com/crazy-max/WindowsSpyBlocker/releases/latest"><img src="https://img.shields.io/github/downloads/crazy-max/WindowsSpyBlocker/total.svg?style=flat-square" alt="Total downloads"></a>
<a href="https://ci.appveyor.com/project/crazy-max/WindowsSpyBlocker"><img src="https://img.shields.io/appveyor/ci/crazy-max/WindowsSpyBlocker.svg?style=flat-square" alt="AppVeyor"></a>
<br /><a href="https://goreportcard.com/report/github.com/crazy-max/WindowsSpyBlocker"><img src="https://goreportcard.com/badge/github.com/crazy-max/WindowsSpyBlocker?style=flat-square" alt="Go Report"></a>
<a href="https://goreportcard.com/report/github.com/crazy-max/WindowsSpyBlocker"><img src="https://goreportcard.com/badge/github.com/crazy-max/WindowsSpyBlocker?style=flat-square" alt="Go Report"></a>
<a href="https://www.codacy.com/app/crazy-max/WindowsSpyBlocker"><img src="https://img.shields.io/codacy/grade/1e2eae1a40754d88b7956cf9bd30241b.svg?style=flat-square" alt="Code Quality"></a>
<a href="https://libraries.io/github/crazy-max/WindowsSpyBlocker"><img src="https://img.shields.io/librariesio/github/crazy-max/WindowsSpyBlocker.svg?style=flat-square" alt="Dependency Status"></a>
<br /><a href="https://beerpay.io/crazy-max/WindowsSpyBlocker"><img src="https://img.shields.io/beerpay/crazy-max/WindowsSpyBlocker.svg?style=flat-square" alt="Beerpay"></a>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CXF2HBWCMSZVL"><img src="https://img.shields.io/badge/donate-paypal-7057ff.svg?style=flat-square" alt="Donate Paypal"></a>
</p>

Expand Down Expand Up @@ -48,9 +47,9 @@ All traffic events are available in the `logs` folder :

The `data` folder contains the blocking rules based on domains or IPs detected during the capture process :

* `data/<type>/winX/spy.txt` : Block Windows Spy / Telemetry
* `data/<type>/winX/update.txt` : Block Windows Update
* `data/<type>/winX/extra.txt` : Block third party applications
* `data/<type>/extra.txt` : Block third party applications
* `data/<type>/spy.txt` : Block Windows Spy / Telemetry
* `data/<type>/update.txt` : Block Windows Update

[Firewall](../../wiki/dataFirewall) and [Hosts](../../wiki/dataHosts) data are the main types. The others are generated from these as :

Expand Down Expand Up @@ -79,8 +78,7 @@ All kinds of contributions are welcomed :raised_hands:!<br />
The most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon:<br />
But we're not gonna lie to each other, I'd rather you buy me a beer or two :beers:!

[![Beerpay](https://beerpay.io/crazy-max/WindowsSpyBlocker/badge.svg?style=beer-square)](https://beerpay.io/crazy-max/WindowsSpyBlocker)
or [![Paypal](.res/paypal.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CXF2HBWCMSZVL)
[![Paypal](.res/paypal-donate.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CXF2HBWCMSZVL)

## License

Expand Down
1,900 changes: 290 additions & 1,610 deletions app/bindata/bindata.go

Large diffs are not rendered by default.

38 changes: 3 additions & 35 deletions app/cmds/dev/dev.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
package dev

import (
"fmt"
"os"
"path"
"strings"
"time"

"github.com/crazy-max/WindowsSpyBlocker/app/bindata"
"github.com/crazy-max/WindowsSpyBlocker/app/cmds/dev/diff"
"github.com/crazy-max/WindowsSpyBlocker/app/cmds/dev/firewall"
"github.com/crazy-max/WindowsSpyBlocker/app/cmds/dev/merge"
"github.com/crazy-max/WindowsSpyBlocker/app/cmds/dev/proxifier"
"github.com/crazy-max/WindowsSpyBlocker/app/cmds/dev/sysmon"
"github.com/crazy-max/WindowsSpyBlocker/app/cmds/dev/wireshark"
"github.com/crazy-max/WindowsSpyBlocker/app/menu"
"github.com/crazy-max/WindowsSpyBlocker/app/utils/pathu"
"github.com/crazy-max/WindowsSpyBlocker/app/utils/print"
"github.com/fatih/color"
)

Expand Down Expand Up @@ -49,9 +39,9 @@ func Menu(args ...string) (err error) {
Function: diff.Menu,
},
{
Description: "> Merge : Merge firewall and hosts data to multi format (DNSCrypt, OpenWrt, etc...)",
Color: color.FgYellow,
Function: merge.Menu,
Description: "Merge : Merge firewall and hosts data to multi format (DNSCrypt, OpenWrt, etc...)",
Color: color.FgHiYellow,
Function: merge,
},
{
Description: "Extract data : Extract embedded data in the current folder",
Expand All @@ -66,25 +56,3 @@ func Menu(args ...string) (err error) {
menuN.Start()
return
}

func extractData(args ...string) (err error) {
fmt.Println()

if _, err := os.Stat(pathu.Data); err == nil {
dataBackupPath := path.Join(pathu.Current, fmt.Sprintf("%s.%s", "data", time.Now().Format("20060102150405")))
fmt.Printf("Backing current data folder in %s... ", strings.TrimLeft(dataBackupPath, pathu.Current))
if err := os.Rename(pathu.Data, dataBackupPath); err != nil {
print.Error(err)
return nil
}
print.Ok()
}

fmt.Printf("Extracting data in %s... ", pathu.Data)
if err := bindata.RestoreAssets(pathu.Current, "data"); err != nil {
print.Error(err)
}
print.Ok()

return nil
}
67 changes: 44 additions & 23 deletions app/cmds/dev/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,24 @@ func (slice diffs) Swap(i, j int) {
func Menu(args ...string) (err error) {
menuCommands := []menu.CommandOption{
{
Description: "Windows 7",
Description: "All",
Color: color.FgHiYellow,
Function: menuWin7,
Function: diffAll,
},
{
Description: "Windows 8.1",
Description: "Proxifier",
Color: color.FgHiYellow,
Function: menuWin81,
Function: diffProxifier,
},
{
Description: "Windows 10",
Description: "Sysmon",
Color: color.FgHiYellow,
Function: menuWin10,
Function: diffSysmon,
},
{
Description: "Wireshark",
Color: color.FgHiYellow,
Function: diffWireshark,
},
}

Expand All @@ -84,14 +89,14 @@ func Menu(args ...string) (err error) {
return
}

func all(system string) {
func diffAll(args ...string) error {
fmt.Println()
defer timeu.Track(time.Now())

var resultsTmp diffs
resultsTmp = append(resultsTmp, _diff(system, "proxifier", true)...)
resultsTmp = append(resultsTmp, _diff(system, "sysmon", true)...)
resultsTmp = append(resultsTmp, _diff(system, "wireshark", true)...)
resultsTmp = append(resultsTmp, _diff("proxifier", true)...)
resultsTmp = append(resultsTmp, _diff("sysmon", true)...)
resultsTmp = append(resultsTmp, _diff("wireshark", true)...)

var results diffs
duplicates := make(map[string]string)
Expand All @@ -105,26 +110,42 @@ func all(system string) {

if len(results) == 0 {
fmt.Println("No diffs found...")
return
return nil
}

fmt.Println()
color.New(color.FgGreen).Printf("%d", len(results))
fmt.Print(" diff(s) found\n")

_writeResultFile(system, "diff-all", results)
_writeResultFile("diff-all", results)
return nil
}

func diffProxifier(args ...string) error {
prog("proxifier")
return nil
}

func diffSysmon(args ...string) error {
prog("sysmon")
return nil
}

func diffWireshark(args ...string) error {
prog("wireshark")
return nil
}

func prog(system string, prog string) {
func prog(prog string) {
fmt.Println()
defer timeu.Track(time.Now())

_diff(system, prog, false)
_diff(prog, false)
}

func _diff(system string, prog string, all bool) diffs {
func _diff(prog string, all bool) diffs {
var result diffs
hostsCountPath := path.Join(pathu.Logs, system, prog+"-hosts-count.csv")
hostsCountPath := path.Join(pathu.Logs, prog+"-hosts-count.csv")

fmt.Printf("Seeking %s... ", strings.TrimLeft(hostsCountPath, pathu.Current))
if _, err := os.Stat(hostsCountPath); err != nil {
Expand All @@ -143,7 +164,7 @@ func _diff(system string, prog string, all bool) diffs {
defer logFile.Close()

fmt.Print("Getting current data... ")
dataList, err := _getCurrentData(system)
dataList, err := _getCurrentData()
if err != nil {
print.Error(err)
return result
Expand Down Expand Up @@ -189,12 +210,12 @@ func _diff(system string, prog string, all bool) diffs {
fmt.Print(" diff(s) found in ")
color.New(color.FgYellow).Printf("%s\n", strings.TrimLeft(hostsCountPath, pathu.Current))

_writeResultFile(system, "diff-"+prog, result)
_writeResultFile("diff-"+prog, result)
return nil
}

func _writeResultFile(system string, filename string, results diffs) {
csvResultFile, _ := os.Create(path.Join(pathu.Logs, system, filename+".csv"))
func _writeResultFile(filename string, results diffs) {
csvResultFile, _ := os.Create(path.Join(pathu.Logs, filename+".csv"))
fmt.Printf("\nGenerating %s... ", strings.TrimLeft(csvResultFile.Name(), pathu.Current))
csvResultFile.WriteString("HOST,ORGANIZATION,COUNTRY,RESOLVED DATE,RESOLVED DOMAIN")
sort.Sort(results)
Expand Down Expand Up @@ -234,10 +255,10 @@ func _writeResultFile(system string, filename string, results diffs) {
csvResultFile.Close()
}

func _getCurrentData(system string) ([]string, error) {
func _getCurrentData() ([]string, error) {
var result []string

firewallIPs, err := data.GetFirewallIps(system)
firewallIPs, err := data.GetFirewallIps()
if err != nil {
return result, err
}
Expand All @@ -253,7 +274,7 @@ func _getCurrentData(system string) ([]string, error) {
}
}

hosts, err := data.GetHosts(system)
hosts, err := data.GetHosts()
if err != nil {
return result, err
}
Expand Down
58 changes: 0 additions & 58 deletions app/cmds/dev/diff/win10.go

This file was deleted.

58 changes: 0 additions & 58 deletions app/cmds/dev/diff/win7.go

This file was deleted.

Loading

0 comments on commit c9e2824

Please sign in to comment.