Networking with python
Python Basic modules:
we are going to see .. the basic library and modules of python related to networking.
1. sys
2.parser
3.socket
4.re
5.http.client
6.pcapy
7.scapy
8.struct
9.ssl
10.smtplib
11.MIME
12.poplib
13.imaplib
14.getpass
15.ftplib
16.telnetlib
17.httplib
18.base64
19.string
20.urllib
21.HTMLParser
22.Threading
23.pyfuzz
24.winappdbg
25.Image
26.stepic
27.crypto
28.binascii
29.mysqldb
30._winreg
31.os
32.argparse
33.psutil
34.sqlite3
35.Time
36.datetime
37.twisted
38.reactor
39.protocol
40.math
41.pip
These are the modules we going to see.
apart from these if you want your own module you can write a module with your self you can import the module to the python IDE.
Sys():
Now we are going to see about sys module in python
what is sys module?
sys module is used for getting exact meaning of the coding.
sys has lots of commands with different opertions.
ex:
sys.argv()
sys.exit()
sys.flags()
sys.gettrace()
sys.path()
sys.platform()
parser():
organize the the data in a structure as per the python grammar and given the correct format to the compiler.
Like get parser tree order.
socket():
socket
is used for communication between the device as per layer level. socket
have the communication related information like port number.
socket mainly used for communication purpose in the protocols like TCP/UDP.
socket is two families
1.IPv4
2.IPv6
also it is two types
1.TCP socket
2.UDP socket
Re():
re () is used for regular expressions. Python have some regular expression in it own.
If we want to use the expression we have to import the re.
example expressions:
/, \\, \\\, \\\\.
above is quote confusing but they're different meaning and used for different purposes in the python.
http.client:
This module define the class implemented by client site protocols like HTTP, HTTPS.
most of the time this module is used with urllib.request.
It will use for following operations.
1.HTTP Object connection.
2.HTTP Object response.
3.HTTP message with object.
urllib.request:
This module define the functions and class of opening urls.
It is mainly used for request the object.
If we import the usrlib.request module we can request and handle the HTTP, HTTPS and FTP Objects in different ways..
following purpose we can use the urllib.request module.
1.Open a director object
2.Base Handler object
3.HTTP Redirect Handler object
4.HTTP cookie processor object
5.Proxy handler object
6.HTTP password manager object
7.Abstract basic authority Handler object
8.proxy basic authentication Handler object
9.Abstract digest authority Handler object
10.HTTPS, HTTP and FTP Handler object.
following purpose we can use the urllib.request module.
1.Open a director object
2.Base Handler object
3.HTTP Redirect Handler object
4.HTTP cookie processor object
5.Proxy handler object
6.HTTP password manager object
7.Abstract basic authority Handler object
8.proxy basic authentication Handler object
9.Abstract digest authority Handler object
10.HTTPS, HTTP and FTP Handler object.
pcapy:
pcapy module is used for pocket captured related purposes.
pcapy mostly used for threads,
And we can use independent libpcap and winpcalp.
pcapy mostly used for sniffing purpose.
scapy
scapy is module used same as like pcapy. like decoding, packet capture and so many purpose.
It is commonly used for scanning, ping, tracert and so many needs.
struct.
struct module is used for convert string to byte.
for example the string is converted as a compile format.
It has lot of class based on the operation.
like
struct.struct()
pack()
unpack()
ssl coket we can use as a normal socket operations with ssl context.
SSL:
ssl module used for some transport layer security purpose.
Using ssl module we can create standalone socket.ssl coket we can use as a normal socket operations with ssl context.
smtplib:
smtplib is mention the session time with object like mail object and internet object.
MIME:
It is support for Email service objects.
These Python modules are used a lot in network programming. I have thoroughly enjoyed reading your points and have come to the conclusion that you are right about many of them. I appreciate your efforts in writing these regular tech updates. Thank you for sharing this. Great blog. Coding interview questions.
ReplyDelete