@@ -575,38 +575,44 @@ def getShellByFeiFeiCMS(url):
575
575
except Exception , e :
576
576
return "no info!"
577
577
578
- def fetchIPs (value ,page ):
578
+ def fetchCensys (value , field ,page ):
579
579
API_URL = "https://www.censys.io/api/v1"
580
580
UID = "3ac350c3-21f9-46be-aeb7-d18f832006f9" #Your API UID
581
581
SECRET = "UBqUKkuUevh2pZqfO3fQalqNVDheGWuc" #Your API SECRET
582
582
value = value .strip ()
583
+ field = field .strip ()
583
584
now = time .strftime ('%H:%M:%S' ,time .localtime (time .time ()))
584
- print "[" + str (now )+ "] [INFO] Fetching IPs from Censys..."
585
+ print "[" + str (now )+ "] [INFO] Fetching IPs/URLs from Censys..."
585
586
for i in range (1 ,page ):
586
587
data = {
587
588
"query" :value ,
588
589
"page" :int (i ),
589
- "fields" :["ip" ]
590
+ "fields" :[field ]
590
591
}
591
- res = requests .post (API_URL + "/search/ipv4" , data = json .dumps (data ), auth = (UID , SECRET )).text
592
+ if field == "ip" :
593
+ res = requests .post (API_URL + "/search/ipv4" , data = json .dumps (data ), auth = (UID , SECRET )).text
594
+ elif field == "domain" :
595
+ res = requests .post (API_URL + "/search/websites" , data = json .dumps (data ), auth = (UID , SECRET )).text
592
596
try :
593
597
results = json .loads (res )
594
598
for result in results ["results" ]:
595
- ip = result ["ip" ]
599
+ censys = result [field ]
596
600
mynow = time .strftime ('%H:%M:%S' ,time .localtime (time .time ()))
597
- logfile (ip ,'censys.txt' )
598
- print "[" + str (mynow )+ "] [INFO] " + ip
601
+ if field == "domain" :
602
+ censys = "http://" + censys
603
+ logfile (censys ,'censys.txt' )
604
+ print "[" + str (mynow )+ "] [INFO] " + censys
599
605
except Exception :
600
606
mynow = time .strftime ('%H:%M:%S' ,time .localtime (time .time ()))
601
607
print "[" + str (mynow )+ "] [WARNING] nothing found, please check API UID and SECRET!"
602
608
output = os .path .dirname (os .path .realpath (__file__ ))+ "/censys.txt"
603
609
if os .path .exists (output ):
604
- print "\n [INFO] Fetched IPs:"
610
+ print "\n [INFO] Fetched IPs/URLs :"
605
611
print "[*] Output File: " + output
606
612
607
613
def myhelp ():
608
614
print "\n +-----------------------------+"
609
- print "| hackUtils v0.0.5 |"
615
+ print "| hackUtils v0.0.6 |"
610
616
print "| Avfisher - avfisher.win |"
611
617
612
618
print "+-----------------------------+\n "
@@ -615,7 +621,8 @@ def myhelp():
615
621
print " -h, --help Show basic help message and exit"
616
622
print " -b keyword, --baidu=keyword Fetch URLs from Baidu based on specific keyword"
617
623
print " -g keyword, --google=keyword Fetch URLs from Google based on specific keyword"
618
- print " -c keyword, --censys=keyword Fetch IPs from Censys based on specific keyword"
624
+ print " -i keyword, --censysip=keyword Fetch IPs from Censys based on specific keyword"
625
+ print " -u keyword, --censysurl=keyword Fetch URLs from Censys based on specific keyword"
619
626
print " -w keyword, --wooyun=keyword Fetch URLs from Wooyun Corps based on specific keyword"
620
627
print " -j url|file, --joomla=url|file Exploit SQLi for Joomla 3.2 - 3.4"
621
628
print " -r url|file, --rce=url|file Exploit Remote Code Execution for Joomla 1.5 - 3.4.5 (Password: handle)"
@@ -625,7 +632,8 @@ def myhelp():
625
632
print "\n Examples:"
626
633
print " hackUtils.py -b inurl:www.example.com"
627
634
print " hackUtils.py -g inurl:www.example.com"
628
- print " hackUtils.py -c 1099.java-rmi"
635
+ print " hackUtils.py -i 1099.java-rmi"
636
+ print " hackUtils.py -u 1099.java-rmi"
629
637
print " hackUtils.py -w .php?id="
630
638
print " hackUtils.py -j http://www.joomla.com/"
631
639
print " hackUtils.py -j urls.txt"
@@ -639,7 +647,7 @@ def myhelp():
639
647
640
648
def main ():
641
649
try :
642
- options ,args = getopt .getopt (sys .argv [1 :],"hb:g:c: w:j:r:f:d:e:" ,["help" ,"baidu=" ,"google=" ,"censys =" ,"wooyun=" ,"joomla=" ,"rce=" ,"ffcms=" ,"domain=" ,"encrypt=" ])
650
+ options ,args = getopt .getopt (sys .argv [1 :],"hb:g:i:u: w:j:r:f:d:e:" ,["help" ,"baidu=" ,"google=" ,"censysid=" , "censysurl =" ,"wooyun=" ,"joomla=" ,"rce=" ,"ffcms=" ,"domain=" ,"encrypt=" ])
643
651
except getopt .GetoptError :
644
652
print "\n [WARNING] error, to see help message of options run with '-h'"
645
653
sys .exit ()
@@ -651,8 +659,10 @@ def main():
651
659
fetchUrls ('baidu' ,value ,50 )
652
660
if name in ("-g" ,"--google" ):
653
661
fetchUrls ('google' ,value ,50 )
654
- if name in ("-c" ,"--censys" ):
655
- fetchIPs (value ,50 )
662
+ if name in ("-i" ,"--censysip" ):
663
+ fetchCensys (value ,"ip" ,50 )
664
+ if name in ("-u" ,"--censysurl" ):
665
+ fetchCensys (value ,"domain" ,50 )
656
666
if name in ("-w" ,"--wooyun" ):
657
667
fetchUrls ('wooyun' ,value ,50 )
658
668
if name in ("-j" ,"--joomla" ):
0 commit comments