NameError:全局名称' self'没有定义

时间:2016-01-04 17:02:08

标签: python

嗨,我很抱歉长码,但我会尝试削减一些 如果想要请求用户放置目标IP然后从菜单中选择:)功能正常但问题和下一步我dident khnow怎么办:/抱歉我的英语不好

menuu = """
  1) Get all websites
  2) Get joomla websites
  3) Get wordpress websites
  4) Find control panel
  5) Find zip files
  6) Find upload files
  7) Get server users
  8) Scan from SQL injection
   9) Crawl and scan from SQL injection
   10) Scan ports (range of ports)
   11) Scan ports (common ports  )
   12) Get server banner
   13) Bypass Cloudflare
   99) Exit
  """
  def unique(seq):
      """
get unique from list found it on stackoverflow
"""
seen = set()
return [seen.add(x) or x for x in seq if x not in seen]

  def clearScr() :
"""
clear the screen in case of GNU/Linux or 
windows 
"""
if system() == 'Linux':
    os.system('clear')
if system() == 'Windows':
    os.system('cls')

  class TNscan :
def __init__(self, serverip) :
    self.serverip = serverip
    self.getSites(False)
    print menuu
    while True :
        choice = raw_input(' Enter choice -> ')
        if choice == '1' :
            self.getSites(True)
        elif choice == '2' :
            self.getJoomla()
        elif choice == '3' :
            self.getWordpress()
        elif choice == '4' :
            self.findPanels()
        elif choice == '5' :
            self.findZip()
        elif choice == '6' :
            self.findUp()
        elif choice == '7' :
            self.getUsers()
        elif choice == '8' :
            self.grabSqli()
        elif choice == '9' :
            nbpages = int(raw_input(' Enter number of pages to crawl               (ex : 100) -> '))
            self.crawlSqli(nbpages)
        elif choice == '10' :
            ran = raw_input(' Enter range of ports, (ex : 1-1000) -> ')
            self.portScanner(1, ran)
        elif choice == '11' :
            self.portScanner(2, None)
        elif choice == '12' :
            self.getServerBanner()
        elif choice == '13' :
            self.cloudflareBypasser()
        elif choice == '99' :
            print ' Goodbye'
            exit()
        con = raw_input(' Continue [Y/n] -> ')
        if con[0].upper() == 'N' :
            exit()
        else :
            clearScr()
            print menuu

然后,我在这里提出了许多功能,

def tnn():

    clearScr()
    aaa = raw_input("Target IP : ")
    aaa = self.serverip
    TNscan()

这里是我要做的事情

1 个答案:

答案 0 :(得分:0)

感谢@pythontips

class tnn():
    def __init__(self):
        clearScr()
        aaa = raw_input("Target IP : ")
        TNscan(aaa)