Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- console.py.orig 2014-03-19 01:20:55.354217434 +0200
- +++ console.py 2014-03-22 12:00:35.252385497 +0200
- @@ -16,6 +16,7 @@
- import sys
- import re
- from md5 import md5
- + from collections import OrderedDict
- from optparse import OptionParser, OptionGroup
- except ImportError, IE:
- print "\n[-] One or more modules is/are missing\n\n" \
- @@ -363,7 +364,7 @@
- else:
- self._PLIST.pop(self.elem)
- - def proxy_list(self, register=False, _PLIST=PROXYLIST, *proxies):
- + def proxy_list(self, register=False, _PLIST=PROXYLIST, **proxies):
- """Lists PROXYLIST"""
- self.__cmd__ = "list"
- self.__name__ = "%s_%s" % (self.__rootcmd__, self.__cmd__)
- @@ -377,7 +378,7 @@
- 'execve': str(self.__execve__)+".%s" %
- self.__name__,
- 'cmd': self.__name__.replace("_", " "),
- - 'args': ['True', 'False', 'PROXYLIST', '%s']
- + 'args': [True, {'proxies': ['']}]
- }
- )
- return True
- @@ -387,30 +388,26 @@
- self.count = 0
- if len(self.proxies):
- print
- - DEBUG("Fetching proxy list for: %s" % self.proxies, 1, True)
- + DEBUG("Fetching proxy list for: %s" %
- + self.proxies[self.proxies.keys()[0]],
- + 1, True)
- # then try to fetch each one
- if len(self._PLIST.keys()) >= 1:
- + for val in self.proxies.values()[0]:
- + if val.strip() not in ['']:
- found = False
- - for self.proxy in self.proxies:
- for k, v in self._PLIST.items():
- - if str(self.proxy) == k or str(self.proxy) == v:
- - try:
- + if k == val:
- DEBUG('Found id: %s stored with value: %s' %
- (k, v), 1)
- - if not found:
- found = True
- - except:
- - found = False
- - try:
- - DEBUG('Found: %s stored with id: %s'
- - % (v, k), 1)
- - if not found:
- + elif v == val:
- + DEBUG('Found: %s stored with id: %s' %
- + (v, k), 1)
- found = True
- - except:
- - pass
- - if found == False:
- - DEBUG("Couldn't find %s" % self.proxy, 1)
- + if not found:
- + DEBUG("Couldn't find %s" % val, 1)
- print
- else:
- DEBUG('List is empty\n', 3)
- @@ -571,21 +568,22 @@
- if MENU.get(index[0]):
- try:
- func = MENU[index[0]][index[1]]
- - param = re.findall(r"'\s*([^']*?)\s*'",
- - str(func['args'][1:]) % \
- - ",".join(index[2:]).\
- - strip(",")
- - )
- - DEBUG("Got plain param list -> %s" % param,
- - reach=5)
- - paraml = ""
- - for x in param:
- - paraml += x+","
- - paraml = paraml.strip(",")
- - DEBUG("Fetched parameter list -> %s" % paraml,
- +
- + param = index[2:][0].split(",")
- + # FIX ME
- + param = [x for x in param \
- + if x.strip() not in ['', ' ']]
- + DEBUG("Fetched parameter list -> %s" % param,
- reach=5)
- + # remove duplicates and keep ordered set
- + param = list(OrderedDict.fromkeys(param))
- +
- if func['args'][0]:
- - eval(func['execve'])(*eval(paraml))
- + eval(func['execve'])(
- + **{func['args'][1].keys()[0]:
- + param
- + }
- + )
- else:
- DEBUG("This command does not take "
- "any arguments\n", 1, force=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement