<s> import bbqsql <EOL> from bbq_core import bcolors <EOL> from config import RequestsConfig , bbqsqlConfig <EOL> import text <EOL> import bbq_core <EOL> import time <EOL> import os <EOL> import sys <EOL> import argparse <EOL> from ConfigParser import RawConfigParser , NoSectionError , MissingSectionHeaderError <EOL> from copy import copy <EOL> exclude_parms = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> class bbqMenu ( ) : <EOL> def __init__ ( self , run_config = None ) : <EOL> self . config_file = '<STR_LIT>' <EOL> try : <EOL> requests_config = RequestsConfig ( ) <EOL> bbqsql_config = bbqsqlConfig ( ) <EOL> results = None <EOL> error = None <EOL> valid = False <EOL> choice = '<STR_LIT>' <EOL> while choice not in [ '<STR_LIT>' , <NUM_LIT> , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> bbq_core . show_banner ( ) <EOL> show_main_menu = bbq_core . CreateMenu ( text . main_text , text . main_menu ) <EOL> print '<STR_LIT>' <EOL> rvalid = requests_config . validate ( ) <EOL> bvalid = bbqsql_config . validate ( ) <EOL> valid = rvalid and bvalid <EOL> if results and len ( results ) <= <NUM_LIT:100> : <EOL> print results <EOL> elif results : <EOL> print '<STR_LIT>' + str ( len ( results ) ) + '<STR_LIT>' <EOL> print results [ - <NUM_LIT:100> : ] <EOL> print '<STR_LIT>' <EOL> try : <EOL> import readline <EOL> readline . parse_and_bind ( '<STR_LIT>' ) <EOL> except ImportError : <EOL> print '<STR_LIT>' <EOL> pass <EOL> try : <EOL> readline . parse_and_bind ( '<STR_LIT>' ) <EOL> fname = raw_input ( '<STR_LIT>' ) <EOL> except : <EOL> print "<STR_LIT>" <EOL> pass <EOL> if fname is not None : <EOL> f = open ( fname , '<STR_LIT:w>' ) <EOL> f . write ( "<STR_LIT:\n>" . join ( "<STR_LIT:U+002C>" , results ) ) <EOL> f . close ( ) <EOL> if error : print bbq_core . bcolors . RED + error + bbq_core . bcolors . ENDC <EOL> if run_config : <EOL> tmp_req_config = dict ( ) <EOL> tmp_http_config = dict ( ) <EOL> try : <EOL> attack_config = RawConfigParser ( ) <EOL> self . config_file = [ run_config , self . config_file ] [ run_config is '<STR_LIT>' ] <EOL> attack_config . read ( self . config_file ) <EOL> except : <EOL> pass <EOL> try : <EOL> for key , val in attack_config . items ( '<STR_LIT>' ) : <EOL> tmp_req_config [ key ] = val <EOL> for key , val in attack_config . items ( '<STR_LIT>' ) : <EOL> tmp_http_config [ key ] = val <EOL> requests_config . set_config ( tmp_req_config ) <EOL> bbqsql_config . set_config ( tmp_http_config ) <EOL> except NoSectionError : <EOL> print "<STR_LIT>" <EOL> run_config = None <EOL> choice = ( raw_input ( bbq_core . setprompt ( ) ) ) <EOL> if choice == '<STR_LIT:1>' : <EOL> requests_config . run_config ( ) <EOL> if choice == '<STR_LIT:2>' : <EOL> bbqsql_config . run_config ( ) <EOL> if choice == '<STR_LIT:3>' : <EOL> try : <EOL> import readline <EOL> readline . parse_and_bind ( '<STR_LIT>' ) <EOL> except ImportError : <EOL> pass <EOL> attack_config = RawConfigParser ( ) <EOL> attack_config . add_section ( '<STR_LIT>' ) <EOL> attack_config . add_section ( '<STR_LIT>' ) <EOL> for key , val in requests_config . get_config ( ) . iteritems ( ) : <EOL> attack_config . set ( '<STR_LIT>' , key , val ) <EOL> for key , val in bbqsql_config . get_config ( ) . iteritems ( ) : <EOL> attack_config . set ( '<STR_LIT>' , key , val ) <EOL> try : <EOL> fname = raw_input ( '<STR_LIT>' % self . config_file ) <EOL> self . config_file = [ fname , self . config_file ] [ fname is '<STR_LIT>' ] <EOL> with open ( self . config_file , '<STR_LIT:wb>' ) as configfile : <EOL> attack_config . write ( configfile ) <EOL> except IOError : <EOL> print '<STR_LIT>' <EOL> pass <EOL> except KeyboardInterrupt : <EOL> pass <EOL> if choice == '<STR_LIT:4>' : <EOL> try : <EOL> import readline <EOL> readline . parse_and_bind ( '<STR_LIT>' ) <EOL> except ImportError : <EOL> pass <EOL> tmp_req_config = dict ( ) <EOL> tmp_http_config = dict ( ) <EOL> attack_config = RawConfigParser ( ) <EOL> try : <EOL> readline . parse_and_bind ( '<STR_LIT>' ) <EOL> fname = raw_input ( '<STR_LIT>' % self . config_file ) <EOL> self . config_file = [ fname , self . config_file ] [ fname is '<STR_LIT>' ] <EOL> attack_config . read ( self . config_file ) <EOL> except : <EOL> pass <EOL> try : <EOL> for key , val in attack_config . items ( '<STR_LIT>' ) : <EOL> tmp_req_config [ key ] = val <EOL> for key , val in attack_config . items ( '<STR_LIT>' ) : <EOL> tmp_http_config [ key ] = val <EOL> requests_config . set_config ( tmp_req_config ) <EOL> bbqsql_config . set_config ( tmp_http_config ) <EOL> except NoSectionError : <EOL> print "<STR_LIT>" <EOL> if choice == '<STR_LIT:5>' and valid : <EOL> results = None <EOL> if bbqsql_config [ '<STR_LIT>' ] and bbqsql_config [ '<STR_LIT>' ] [ '<STR_LIT>' ] : <EOL> bbqsql_config [ '<STR_LIT>' ] = { '<STR_LIT:value>' : bbqsql_config [ '<STR_LIT>' ] [ '<STR_LIT>' ] , '<STR_LIT:name>' : '<STR_LIT>' , '<STR_LIT>' : lambda x : True } <EOL> attack_config = { } <EOL> attack_config . update ( requests_config . get_config ( ) ) <EOL> attack_config . update ( bbqsql_config . get_config ( ) ) <EOL> for key in exclude_parms : <EOL> if key in attack_config : <EOL> del ( attack_config [ key ] ) <EOL> bbq = bbqsql . BlindSQLi ( ** attack_config ) <EOL> if not bbq . error : <EOL> error = None <EOL> try : <EOL> ok = raw_input ( '<STR_LIT>' ) <EOL> except KeyboardInterrupt : <EOL> ok = False <EOL> if ok and ok [ <NUM_LIT:0> ] != '<STR_LIT:n>' : <EOL> results = bbq . run ( ) <EOL> if bbqsql_config [ '<STR_LIT>' ] [ '<STR_LIT:value>' ] is not None : <EOL> f = open ( bbqsql_config [ '<STR_LIT>' ] [ '<STR_LIT:value>' ] , '<STR_LIT:w>' ) <EOL> f . write ( "<STR_LIT:\n>" . join ( results ) ) <EOL> f . close ( ) <EOL> else : <EOL> error = bbq . error <EOL> del ( bbq ) <EOL> if choice == '<STR_LIT>' : <EOL> bbq_core . about ( ) <EOL> bbq_core . ExitBBQ ( <NUM_LIT:0> ) <EOL> except KeyboardInterrupt : <EOL> print "<STR_LIT>" + bbq_core . bcolors . RED + "<STR_LIT:@>" + bbq_core . bcolors . ENDC + "<STR_LIT>" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> parser = argparse . ArgumentParser ( prog = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:version>' , version = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT:-c>' , metavar = '<STR_LIT>' , nargs = '<STR_LIT:+>' , help = '<STR_LIT>' , default = None ) <EOL> results = parser . parse_args ( ) <EOL> print results <EOL> if results . c is not None : <EOL> bbqMenu ( results . c [ <NUM_LIT:0> ] ) <EOL> else : <EOL> bbqMenu ( ) </s>
