Skip to content

Commit

Permalink
add functionnality & class Helpers to CLI!
Browse files Browse the repository at this point in the history
  • Loading branch information
anouarbensaad committed Nov 16, 2019
1 parent 9002937 commit 083cee7
Showing 1 changed file with 127 additions and 60 deletions.
187 changes: 127 additions & 60 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,9 @@
'Connection': 'keep-alive',}

history = []
numberpage=1
output_dir='logs'
variables = {
"URL":'',
"TIMEOUT":'',
"URL":'',
"COMMAND":'',
"FILE_PATH":'',
"USERNAME":'',
"PASSWORD":''
}

numberpage=1 #default page−dork variable
output_dir='logs'#default output−dork

W_UL= "\033[4m"
RED_U='\033[1;1;91m'
Expand All @@ -62,25 +54,11 @@
'subdomains':list(subdomains),
}

class Cli():

def __runExploits(self,url,headers):
wp_wysija(url,headers,vulnresults)
wp_blaze(url,headers,vulnresults)
wp_catpro(url,headers,vulnresults)
wp_cherry(url,headers,vulnresults)
wp_dm(url,headers,vulnresults)
wp_fromcraft(url,headers,vulnresults)
wp_shop(url,headers,vulnresults)
wp_revslider(url,headers,vulnresults)
wp_adsmanager(url,headers,vulnresults)
wp_inboundiomarketing(url,headers,vulnresults)
wp_levoslideshow(url,headers,vulnresults)
wp_adblockblocker(url,headers,vulnresults)
class Helpers():

@staticmethod
def _general_help():
generalhelp=print("""
print("""
Command Description
-------- -------------
help/? Show this help menu.
Expand All @@ -95,94 +73,183 @@ def _general_help():
os <command> Execute a system command without closing the vulnx-mode
exit/quit Exit the vulnx-mode
""")
return generalhelp

@staticmethod
def _url_action_help():
urlactions=print("""
print("""
Command Description
-------- -------------
? \t\tHelp menu
timeout \t\tset timeout
ports \t\tscan ports
domain \t\tget domains & sub domains
cms info \t\tget cms info (version , user ..)
web info \t\tget web info
dump dns \t\tdump dns get sub domains [mx-server..]
run exploit\t\trun exploits corresponding to cms
back \t\tmove back from current context
? Help menu
timeout set timeout
ports scan ports
domain get domains & sub domains
cms info get cms info (version , user ..)
web info get web info
dump dns dump dns get sub domains [mx-server..]
run exploit run exploits corresponding to cms
back move back from current context
""")
return urlactions

#dorks - command helpers.

@staticmethod
def _dorks_action_help():
print("""
Command Description
-------- -------------
? \t\tHelp menu
list \t\tlist dorks
set dork \t\tset exploit name
num page \t\tset num page
run \t\tsearch web with specified dork
back \t\tmove back from current context
? Help menu
list list dorks
set dork set exploit name
back move back from current context
""")

@staticmethod
def _dorks_setdork_help():
print("""
Command Description
-------- -------------
? Help menu
pages set num page
output output file.
run search web with specified dork
back move back from current context
""")

@staticmethod
def _dorks_setdork_page_help():
print("""
Command Description
-------- -------------
? Help menu
output output file.
run search web with specified dork
back move back from current context
""")

@staticmethod
def _dorks_setdork_output_help():
print("""
Command Description
-------- -------------
? Help menu
pages set num page
run search web with specified dork
back move back from current context
""")

@staticmethod
def _dorks_setdork_page_output_help():
print("""
Command Description
-------- -------------
? Help menu
run search web with specified dork
back move back from current context
""")

class Cli(object):

def __runExploits(self,url,headers):
wp_wysija(url,headers,vulnresults)
wp_blaze(url,headers,vulnresults)
wp_catpro(url,headers,vulnresults)
wp_cherry(url,headers,vulnresults)
wp_dm(url,headers,vulnresults)
wp_fromcraft(url,headers,vulnresults)
wp_shop(url,headers,vulnresults)
wp_revslider(url,headers,vulnresults)
wp_adsmanager(url,headers,vulnresults)
wp_inboundiomarketing(url,headers,vulnresults)
wp_levoslideshow(url,headers,vulnresults)
wp_adblockblocker(url,headers,vulnresults)

@staticmethod
def _clearscreen():
return os.system('clear')

@staticmethod
def getDork(pattern):
dork_search=r'^set dork (.+)'
dork=re.search(re.compile(dork_search),pattern).group(1)
try:
dork=re.search(re.compile(dork_search),pattern).group(1)
except AttributeError: # No match is found
dork=re.search(re.compile(dork_search),pattern)
if dork:
return dork

@staticmethod
def setPage(page):
page_search=r'^page (\d+$)'
try:
page=re.search(re.compile(page_search),page).group(1)
except AttributeError: # No match is found
page=re.search(re.compile(page_search),page)
if page:
return int(page)

@property
def getUrl(self,pattern):
url_search=r'^set url (.+)'

url=re.search(re.compile(url_search),pattern).group(1)

try:
url=re.search(re.compile(url_search),pattern).group(1)
except AttributeError: # No match is found
url=re.search(re.compile(url_search),pattern)
if url:
return url#ParseURL(url)
else:
print("need (help) (?)")


def setdorkCLI(self,cmd_interpreter):

'''SET DORK VARIABLE'''
while True:
dorkname=re.compile(r'^set dork')
dorkname=re.compile(r'^set dork .+')
cmd_interpreter=input("%s%svulnx%s%s (%sDorks%s)> %s" %(bannerblue2,W_UL,end,W,B,W,end))
if cmd_interpreter == 'back':
break
if cmd_interpreter == 'list':

'''SET DORK LIST'''
print('\n%s[*]%s Listing dorks name..' %(B,end))
from modules.dorksEngine import DorkList as DL
DL.dorkslist()

'''SET DORK NAME.'''
elif dorkname.search(cmd_interpreter):
while True:
cmd_interpreter_wp=input("%s%svulnx%s%s (%sDorks-%s%s)> %s" %(bannerblue2,W_UL,end,W,B,Cli.getDork(cmd_interpreter),W,end))
page=re.compile(r'^page \d+$')

'''SET PAGE VARIABLE.'''
if page.search(cmd_interpreter_wp):
while True:
cmd_interpreter_wp_page=input("%s%svulnx%s%s (%sDorks-%s-%s%s)> %s" %(bannerblue2,W_UL,end,W,B,Cli.getDork(cmd_interpreter),Cli.setPage(cmd_interpreter_wp),W,end))
if cmd_interpreter_wp_page=='run':
print('\n')
from modules.dorksEngine import Dorks as D
D.searchengine(Cli.getDork(cmd_interpreter),headers,output_dir,Cli.setPage(cmd_interpreter_wp))
if cmd_interpreter_wp_page=='back':
break

if cmd_interpreter_wp=='run':
print('\n')
from modules.dorksEngine import Dorks as D
D.searchengine(Cli.getDork(cmd_interpreter),headers,output_dir,numberpage)

if cmd_interpreter_wp=='back':
break

if cmd_interpreter == 'help' or cmd_interpreter == '?':
self._dorks_action_help()
Helpers._dorks_action_help()



def send_commands(self,cmd):
reurl=re.compile(r'^set url')
reurl=re.compile(r'^set url .+')
redork=re.compile(r'^dork')
while True:
cmd = input("%s%svulnx%s > "% (bannerblue2,W_UL,end))
dork_command="dorks"

if reurl.search(cmd):

#url session

while True:
cmd_interpreter=input("%s%svulnx%s%s target(%s%s%s) > %s" %(bannerblue2,W_UL,end,W,R,self.getUrl(cmd),W,end))
if cmd_interpreter == 'back':
Expand All @@ -196,7 +263,7 @@ def send_commands(self,cmd):
url_root = 'http://'+url_root
self.__runExploits(url_root,headers)
elif cmd_interpreter == 'help' or cmd_interpreter == '?':
Cli._url_action_help()
Helpers._url_action_help()
elif cmd == 'quit' or cmd == 'exit':
sys.exit()
else:
Expand All @@ -207,7 +274,7 @@ def send_commands(self,cmd):
elif cmd == 'quit' or cmd == 'exit':
sys.exit()
elif cmd == 'help' or cmd == '?':
self._general_help()
Helpers._general_help()
elif cmd == 'clear' or cmd == 'cls':
Cli._clearscreen()

Expand Down

0 comments on commit 083cee7

Please sign in to comment.