-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95f2937
commit 932c9e4
Showing
10 changed files
with
252 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"sync" | ||
) | ||
|
||
func main() { | ||
// scanning too quickly | ||
//for i := 1; i <= 1024; i++ { | ||
// go func(j int) { | ||
// address := fmt.Sprintf("192.168.56.101:%d", j) | ||
// conn, err := net.Dial("tcp", address) | ||
// if err != nil { | ||
// return | ||
// } | ||
// err = conn.Close() | ||
// if err != nil { | ||
// log.Fatal(err) | ||
// } | ||
// fmt.Println("%d open\n", j) | ||
// }(i) | ||
//} | ||
|
||
host := "scanme.nmap.org" | ||
var wg sync.WaitGroup | ||
for i := 1; i < 1024; i++ { | ||
wg.Add(1) | ||
go func(j int) { | ||
defer wg.Done() | ||
address := fmt.Sprintf("%s:%d", host, j) | ||
conn, err := net.Dial("tcp", address) | ||
if err != nil { | ||
return | ||
} | ||
err = conn.Close() | ||
if err != nil { | ||
fmt.Println("[-] Error closing connection!") | ||
return | ||
} | ||
fmt.Printf("[+] %d open\n", j) | ||
}(i) | ||
} | ||
wg.Wait() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"sync" | ||
) | ||
|
||
func scanPort(port int, wg *sync.WaitGroup) { | ||
defer wg.Done() | ||
IP := "192.168.56.101" | ||
address := fmt.Sprintf(IP+":%d", port) | ||
connection, err := net.Dial("tcp", address) | ||
if err == nil { | ||
fmt.Printf("[+] Connection established... PORT %v\n", port) | ||
} else { | ||
fmt.Printf("[-] No connection established... PORT %v\n", port) | ||
return | ||
} | ||
connection.Close() | ||
} | ||
|
||
func main() { | ||
var wg sync.WaitGroup | ||
for i := 1; i < 100; i++ { | ||
wg.Add(1) | ||
go scanPort(i, &wg) | ||
} | ||
wg.Wait() | ||
fmt.Println("[+] Execution completed.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package main | ||
|
||
func main() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"net" | ||
) | ||
|
||
func main() { | ||
// testing for loop | ||
//for i := 1; i <= 1024; i++ { | ||
// address := fmt.Sprintf("scanme.nmap.org:%d", i) | ||
// fmt.Println(address) | ||
//} | ||
|
||
for i := 1; i <= 1024; i++ { | ||
host := "192.168.56.101" | ||
address := fmt.Sprintf("%s:%d", host, i) | ||
// fmt.Printf("Scanning host: %s\n", address) | ||
conn, err := net.Dial("tcp", address) | ||
if err != nil { | ||
// port is closed or filtered if err != nil | ||
continue | ||
} | ||
err = conn.Close() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fmt.Printf("PORT %d: open\n", i) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# bypassing firewalls with port forwarding | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
) | ||
|
||
// main contains a basic port scanner | ||
func main() { | ||
_, err := net.Dial("tcp", "scanme.nmap.org:80") | ||
if err == nil { | ||
fmt.Println("[+] Connection successful.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[+] 22 open | ||
[+] 80 open |