forked from k8gege/LadonGo
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
26 changed files
with
2,396 additions
and
0 deletions.
There are no files selected for viewing
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,156 @@ | ||
package main | ||
//Ladon Scanner for golang | ||
//Author: k8gege | ||
//K8Blog: http://k8gege.org | ||
//Github: https://github.com/k8gege | ||
import ( | ||
"fmt" | ||
//"github.com/k8gege/LadonGo/worker" | ||
//"github.com/k8gege/LadonGo/color" //Only Windows | ||
"github.com/k8gege/LadonGo/t3" | ||
"github.com/k8gege/LadonGo/icmp" | ||
"github.com/k8gege/LadonGo/ping" | ||
"github.com/k8gege/LadonGo/port" | ||
"github.com/k8gege/LadonGo/http" | ||
"github.com/k8gege/LadonGo/smb" | ||
"github.com/k8gege/LadonGo/ftp" | ||
"github.com/k8gege/LadonGo/ssh" | ||
"github.com/k8gege/LadonGo/mysql" | ||
"strings" | ||
"log" | ||
"os" | ||
"runtime" | ||
"net" | ||
"sync" | ||
) | ||
|
||
func help() { | ||
Detection() | ||
BruteFor() | ||
Example() | ||
} | ||
|
||
func Example() { | ||
if runtime.GOOS=="windows" {fmt.Println("\nExample:") | ||
} else{fmt.Println("\033[32m\nExample:\033[0m")} | ||
if runtime.GOOS=="windows" {fmt.Println("Ladon 192.168.1.8/24 MS17010") | ||
} else{fmt.Println("./Ladon 192.168.1.8/24 MS17010")} | ||
fmt.Println("") | ||
} | ||
|
||
func Detection() { | ||
if runtime.GOOS=="windows" {fmt.Println("\nDetection:") | ||
} else{fmt.Println("\033[33m\nDetection:\033[0m")} | ||
fmt.Println("PingScan\t(Using system ping to detect Online hosts)") | ||
fmt.Println("IcmpScan\t(Using ICMP Protocol to detect Online hosts)") | ||
fmt.Println("BannerScan\t(Using HTTP Protocol to detect Banner hosts)") | ||
fmt.Println("WeblogicScan\t(Using T3 Protocol to detect Weblogic hosts)") | ||
fmt.Println("PortScan\t(Scan hosts open ports using TCP protocol)") | ||
fmt.Println("MS17010 \t(Using SMB Protocol to detect MS17010 hosts))") | ||
fmt.Println("SmbGhost\t(Using SMB Protocol to detect SmbGhost hosts))") | ||
|
||
} | ||
|
||
func BruteFor() { | ||
if runtime.GOOS=="windows" {fmt.Println("\nBrute-Force:") | ||
} else{fmt.Println("\033[35m\nBruteForce:\033[0m")} | ||
fmt.Println("SmbScan \t(Using SMB Protocol to Brute-For 445 Port))") | ||
fmt.Println("SshScan \t(Using SSH Protocol to Brute-For 22 Port))") | ||
fmt.Println("FtpScan \t(Using FTP Protocol to Brute-For 21 Port))") | ||
fmt.Println("MysqlScan \t(Using Mysql Protocol to Brute-For 3306 Port))") | ||
} | ||
|
||
|
||
func incIP(ip net.IP) { | ||
for j := len(ip) - 1; j >= 0; j-- { | ||
ip[j]++ | ||
if ip[j] > 0 { | ||
break | ||
} | ||
} | ||
} | ||
var debugLog *log.Logger | ||
func main() { | ||
fmt.Println("LadonGo 1.0 by k8gege") | ||
fmt.Println("Arch: "+runtime.GOARCH+" OS: "+runtime.GOOS) | ||
ParLen := len(os.Args) | ||
if ParLen==1 { | ||
help() | ||
os.Exit(0) | ||
} | ||
EndPar := os.Args[ParLen-1] | ||
Target := os.Args[ParLen-2] | ||
if strings.ToUpper(EndPar)=="HELP"||strings.ToUpper(EndPar)=="/HELP"||strings.ToUpper(EndPar)=="-H"||strings.ToUpper(EndPar)=="-H" { | ||
help() | ||
os.Exit(0) | ||
} | ||
if strings.ToUpper(EndPar)=="BRUTEFOR"||strings.ToUpper(EndPar)=="BRUTE"||strings.ToUpper(EndPar)=="BRUTEFORCE" { | ||
BruteFor() | ||
os.Exit(0) | ||
} | ||
if strings.ToUpper(EndPar)=="DETECTION" { | ||
Detection() | ||
os.Exit(0) | ||
} | ||
if strings.ToUpper(EndPar)=="EXAMPLE"||strings.ToUpper(EndPar)=="USAGE" { | ||
Example() | ||
os.Exit(0) | ||
} | ||
fmt.Println("Targe: "+Target) | ||
log.Println("Start...") | ||
fmt.Println("Load "+EndPar) | ||
ScanType := strings.ToUpper(EndPar) | ||
if strings.Contains(Target, "/") { | ||
if Target != "" { | ||
ip, ipNet, err := net.ParseCIDR(Target) | ||
if err != nil { | ||
fmt.Println(Target +" invalid CIDR") | ||
return | ||
} | ||
var wg sync.WaitGroup | ||
for ip := ip.Mask(ipNet.Mask); ipNet.Contains(ip); incIP(ip) { | ||
wg.Add(1) | ||
go func(ip string) { | ||
defer wg.Done() | ||
LadonScan(ScanType,ip); | ||
}(ip.String()) | ||
} | ||
wg.Wait() | ||
} | ||
} else { | ||
LadonScan(ScanType,Target); | ||
} | ||
log.Println("Finished") | ||
} | ||
func End(){ | ||
log.Println("Finished") | ||
os.Exit(0) | ||
} | ||
func LadonScan(ScanType string,Target string) { | ||
if ScanType == "PINGSCAN" ||ScanType == "PING" { | ||
res,err := ping.CmdPing(Target) | ||
if err==nil && res==true { | ||
fmt.Println("PING: "+Target) | ||
} | ||
} else if ScanType == "ICMPSCAN" ||ScanType == "ICMP" { | ||
icmp.Icmp(Target,debugLog) | ||
} else if ScanType == "PORTSCAN" || ScanType == "SCANPORT" { | ||
port.ScanPort(Target) | ||
} else if ScanType == "BANNERSCAN" { | ||
http.HttpBanner(Target) | ||
} else if ScanType == "T3SCAN" || ScanType=="WEBLOGICSCAN" { | ||
t3.T3version(Target) | ||
} else if ScanType == "MS17010" { | ||
smb.MS17010(Target,3) | ||
} else if ScanType == "SMBSCAN" { | ||
smb.SmbScan(ScanType,Target) | ||
} else if ScanType == "FTPSCAN" { | ||
ftp.FtpScan(ScanType,Target) | ||
} else if ScanType == "SMBGHOST"||ScanType == "CVE-2020-0796" { | ||
smb.SmbGhost(Target,445) | ||
} else if ScanType == "SSHSCAN" { | ||
ssh.SshScan(ScanType,Target) | ||
} else if ScanType == "MYSQLSCAN" { | ||
mysql.MysqlScan(ScanType,Target) | ||
} | ||
} |
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,40 @@ | ||
package color | ||
//Ladon Scanner for golang | ||
//Author: k8gege | ||
//K8Blog: http://k8gege.org | ||
//Github: https://github.com/k8gege | ||
import ( | ||
"syscall" | ||
) | ||
|
||
var ( | ||
kernel32 *syscall.LazyDLL = syscall.NewLazyDLL("kernel32.dll") | ||
proc *syscall.LazyProc = kernel32.NewProc("SetConsoleTextAttribute") | ||
CloseHandle *syscall.LazyProc = kernel32.NewProc("CloseHandle") | ||
FontColor Color = Color{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} | ||
) | ||
|
||
type Color struct { | ||
Black int // 黑色 | ||
Blue int // 蓝色 | ||
Green int // 绿色 | ||
Cyan int // 青色 | ||
Red int // 红色 | ||
Purple int // 紫色 | ||
Yellow int // 黄色 | ||
Light_gray int // 淡灰色(系统默认值) | ||
Gray int // 灰色 | ||
Light_blue int // 亮蓝色 | ||
Light_green int // 亮绿色 | ||
Light_cyan int // 亮青色 | ||
Light_red int // 亮红色 | ||
Light_purple int // 亮紫色 | ||
Light_yellow int // 亮黄色 | ||
White int // 白色 | ||
} | ||
|
||
func ColorPrint(s string, i int) { | ||
handle, _, _ := proc.Call(uintptr(syscall.Stdout), uintptr(i)) | ||
print(s) | ||
CloseHandle.Call(handle) | ||
} |
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,50 @@ | ||
package dic | ||
//Ladon Scanner for golang | ||
//Author: k8gege | ||
//K8Blog: http://k8gege.org | ||
//Github: https://github.com/k8gege | ||
import ( | ||
"fmt" | ||
"bufio" | ||
"strings" | ||
//"log" | ||
"os" | ||
) | ||
|
||
func UserDic() (users []string) { | ||
file, err := os.Open("user.txt") | ||
if err != nil { | ||
fmt.Println("Open user.txt error, %v", err) | ||
} | ||
|
||
defer file.Close() | ||
scanner := bufio.NewScanner(file) | ||
scanner.Split(bufio.ScanLines) | ||
|
||
for scanner.Scan() { | ||
user := strings.TrimSpace(scanner.Text()) | ||
if user != "" { | ||
users = append(users, user) | ||
} | ||
} | ||
return users | ||
} | ||
|
||
func PassDic() (password []string) { | ||
file, err := os.Open("pass.txt") | ||
if err != nil { | ||
fmt.Println("Open pass.txt error, %v", err) | ||
} | ||
|
||
defer file.Close() | ||
scanner := bufio.NewScanner(file) | ||
scanner.Split(bufio.ScanLines) | ||
|
||
for scanner.Scan() { | ||
passwd := strings.TrimSpace(scanner.Text()) | ||
if passwd != "" { | ||
password = append(password, passwd) | ||
} | ||
} | ||
return password | ||
} |
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,8 @@ | ||
package main | ||
import ( | ||
"github.com/k8gege/LadonGo/mysql" | ||
"fmt" | ||
) | ||
func main() { | ||
fmt.Println(mysql.MysqlAuth("192.168.1.21","3306","root","k8gege")) | ||
} |
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,30 @@ | ||
package main | ||
import ( | ||
"fmt" | ||
"flag" | ||
"os" | ||
"github.com/k8gege/LadonGo/ping" | ||
) | ||
//go run pingtest.go -host k8gege.org | ||
var ( | ||
host string | ||
) | ||
|
||
func init() { | ||
flag.StringVar(&host, "host", "", "IP/Host/Domain") | ||
} | ||
|
||
func main() { | ||
flag.Parse() | ||
if host == "" { | ||
println("Please " + os.Args[0] + " -h") | ||
os.Exit(0) | ||
} | ||
|
||
res,err := ping.CmdPing(host) | ||
//res,err := CmdPing("k8gege.org") | ||
if err==nil && res==true { | ||
fmt.Println(host+" IsOnline") | ||
} | ||
|
||
} |
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,7 @@ | ||
package main | ||
import ( | ||
"github.com/k8gege/LadonGo/smb" | ||
) | ||
func main() { | ||
smb.SmbGhost("192.168.1.34", 445) | ||
} |
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,8 @@ | ||
package main | ||
import ( | ||
"log" | ||
"github.com/k8gege/LadonGo/smb" | ||
) | ||
func main() { | ||
log.Println(smb.SmbAuth("192.168.1.21", "445", "k8gege", "k8gege520")) | ||
} |
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,9 @@ | ||
package main | ||
import ( | ||
"log" | ||
"github.com/k8gege/LadonGo/ssh" | ||
) | ||
func main() { | ||
log.Println(ssh.SshAuth("192.168.1.19", "22", "root", "k8team")) | ||
log.Println(ssh.SshAuth("192.168.1.19", "22", "root", "k8gege")) | ||
} |
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 ftp | ||
//Ladon Scanner for golang | ||
//Author: k8gege | ||
//K8Blog: http://k8gege.org | ||
//Github: https://github.com/k8gege | ||
import ( | ||
"github.com/k8gege/LadonGo/goftp" | ||
"github.com/k8gege/LadonGo/port" | ||
"github.com/k8gege/LadonGo/dic" | ||
"github.com/k8gege/LadonGo/logger" | ||
"fmt" | ||
) | ||
|
||
func FtpAuth(ip string, port string, user string, pass string) ( result bool,err error) { | ||
result = false | ||
|
||
//var err error | ||
var Lftp *goftp.FTP | ||
|
||
if Lftp, err = goftp.Connect(ip+":"+port); err != nil { | ||
//fmt.Println(err) | ||
} | ||
|
||
defer Lftp.Close() | ||
|
||
if err = Lftp.Login(user,pass); err == nil { | ||
result = true | ||
} | ||
return result,err | ||
} | ||
|
||
func FtpScan(ScanType string,Target string) { | ||
if port.PortCheck(Target,21) { | ||
Loop: | ||
for _, u := range dic.UserDic() { | ||
for _, p := range dic.PassDic() { | ||
fmt.Println("Check... "+Target+" "+u+" "+p) | ||
res,err := FtpAuth(Target, "21", u, p) | ||
if res==true && err==nil { | ||
logger.PrintIsok(ScanType,Target,u, p) | ||
break Loop | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.