Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.13 KB | None | 0 0
  1. --- console.py.orig 2014-03-19 01:20:55.354217434 +0200
  2. +++ console.py  2014-03-22 12:00:35.252385497 +0200
  3. @@ -16,6 +16,7 @@
  4.      import sys
  5.      import re
  6.      from md5 import md5
  7. +    from collections import OrderedDict
  8.      from optparse import OptionParser, OptionGroup
  9.  except ImportError, IE:
  10.      print "\n[-] One or more modules is/are missing\n\n" \
  11. @@ -363,7 +364,7 @@
  12.              else:
  13.                  self._PLIST.pop(self.elem)
  14.  
  15. -    def proxy_list(self, register=False, _PLIST=PROXYLIST, *proxies):
  16. +    def proxy_list(self, register=False, _PLIST=PROXYLIST, **proxies):
  17.          """Lists PROXYLIST"""
  18.          self.__cmd__ = "list"
  19.          self.__name__ = "%s_%s" % (self.__rootcmd__, self.__cmd__)
  20. @@ -377,7 +378,7 @@
  21.                                  'execve': str(self.__execve__)+".%s" %
  22.                                                            self.__name__,
  23.                                  'cmd': self.__name__.replace("_", " "),
  24. -                                'args': ['True', 'False', 'PROXYLIST', '%s']
  25. +                                'args': [True, {'proxies': ['']}]
  26.                                 }
  27.                           )
  28.              return True
  29. @@ -387,30 +388,26 @@
  30.          self.count = 0
  31.          if len(self.proxies):
  32.              print
  33. -            DEBUG("Fetching proxy list for: %s" % self.proxies, 1, True)
  34. +            DEBUG("Fetching proxy list for: %s" %
  35. +                  self.proxies[self.proxies.keys()[0]],
  36. +                  1, True)
  37.  
  38.              # then try to fetch each one
  39.              if len(self._PLIST.keys()) >= 1:
  40. +                for val in self.proxies.values()[0]:
  41. +                    if val.strip() not in ['']:
  42.                  found = False
  43. -                for self.proxy in self.proxies:
  44.                      for k, v in self._PLIST.items():
  45. -                        if str(self.proxy) == k or str(self.proxy) == v:
  46. -                            try:
  47. +                            if k == val:
  48.                                  DEBUG('Found id: %s  stored with value: %s' %
  49.                                        (k, v), 1)
  50. -                                if not found:
  51.                                      found = True
  52. -                            except:
  53. -                                found = False
  54. -                                try:
  55. -                                    DEBUG('Found: %s  stored with id: %s'
  56. -                                          % (v, k), 1)
  57. -                                    if not found:
  58. +                            elif v == val:
  59. +                                DEBUG('Found: %s  stored with id: %s' %
  60. +                                      (v, k), 1)
  61.                                          found = True
  62. -                                except:
  63. -                                    pass
  64. -                    if found == False:
  65. -                        DEBUG("Couldn't find  %s" % self.proxy, 1)
  66. +                        if not found:
  67. +                            DEBUG("Couldn't find  %s" % val, 1)
  68.                  print
  69.              else:
  70.                  DEBUG('List is empty\n', 3)
  71. @@ -571,21 +568,22 @@
  72.                          if MENU.get(index[0]):
  73.                              try:
  74.                                  func = MENU[index[0]][index[1]]
  75. -                                param = re.findall(r"'\s*([^']*?)\s*'",
  76. -                                                   str(func['args'][1:]) % \
  77. -                                                       ",".join(index[2:]).\
  78. -                                                       strip(",")
  79. -                                                  )
  80. -                                DEBUG("Got plain param list -> %s" % param,
  81. -                                      reach=5)
  82. -                                paraml = ""
  83. -                                for x in param:
  84. -                                    paraml += x+","
  85. -                                paraml = paraml.strip(",")
  86. -                                DEBUG("Fetched parameter list -> %s" % paraml,
  87. +
  88. +                                param = index[2:][0].split(",")
  89. +                                # FIX ME
  90. +                                param = [x for x in param \
  91. +                                           if x.strip() not in ['', ' ']]
  92. +                                DEBUG("Fetched parameter list -> %s" % param,
  93.                                        reach=5)
  94. +                                # remove duplicates and keep ordered set
  95. +                                param = list(OrderedDict.fromkeys(param))
  96. +
  97.                                  if func['args'][0]:
  98. -                                    eval(func['execve'])(*eval(paraml))
  99. +                                    eval(func['execve'])(
  100. +                                            **{func['args'][1].keys()[0]:
  101. +                                                param
  102. +                                              }
  103. +                                        )
  104.                                  else:
  105.                                      DEBUG("This command does not take "
  106.                                            "any arguments\n", 1, force=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement