Added Murach python tutorials
This commit is contained in:
parent
b80404e1c4
commit
7530150136
@ -1,7 +1,7 @@
|
|||||||
import socket
|
import socket
|
||||||
|
|
||||||
targetHost = "127.0.0.1"
|
targetHost = "127.0.0.1"
|
||||||
targetPort = 80
|
targetPort = 9999
|
||||||
print(targetHost)
|
print(targetHost)
|
||||||
|
|
||||||
#create a socket object
|
#create a socket object
|
||||||
@ -13,11 +13,14 @@ client.connect((targetHost, targetPort))
|
|||||||
#send some data
|
#send some data
|
||||||
message = "GET / HTTP/1.1\r\nHost: google.com\r\n\r\n"
|
message = "GET / HTTP/1.1\r\nHost: google.com\r\n\r\n"
|
||||||
#we have to encode our string using UTF-8
|
#we have to encode our string using UTF-8
|
||||||
#client.send(message.encode("utf-8"))
|
client.send(message.encode("utf-8"))
|
||||||
|
#client.send(b"GET / HTTP/1.1\r\nHost: google.com\r\n\r\n") ##THIS LINE ENCODE THE STRING AT UTF-8 using the 'b'
|
||||||
|
|
||||||
|
|
||||||
#receive some data
|
#receive some data
|
||||||
response = client.recv(4096) #This is the amount of bytes you want to read!!
|
response = client.recv(4096) #This is the amount of bytes you want to read!!
|
||||||
|
|
||||||
|
client.close()
|
||||||
|
|
||||||
#print the response
|
#print the response
|
||||||
print(response)
|
print(response)
|
||||||
@ -2,7 +2,7 @@
|
|||||||
import socket
|
import socket
|
||||||
|
|
||||||
targetHost = "127.0.0.1"
|
targetHost = "127.0.0.1"
|
||||||
targetPort = 22
|
targetPort = 9999
|
||||||
print(targetHost)
|
print(targetHost)
|
||||||
|
|
||||||
#create a socket object
|
#create a socket object
|
||||||
@ -21,4 +21,4 @@ message = "GET / HTTP/1.1\r\nHost: google.com\r\n\r\n"
|
|||||||
response = client.recv(4096) #This is the amount of bytes you want to read!!
|
response = client.recv(4096) #This is the amount of bytes you want to read!!
|
||||||
|
|
||||||
#print the response
|
#print the response
|
||||||
print(response)
|
print(response)
|
||||||
@ -91,7 +91,7 @@ def main():
|
|||||||
elif o in ("-t","--target"):
|
elif o in ("-t","--target"):
|
||||||
target = a
|
target = a
|
||||||
elif o in ("-p","--port"):
|
elif o in ("-p","--port"):
|
||||||
port = (int)a
|
port = (int)
|
||||||
else:
|
else:
|
||||||
assert False,"Unhandled Option"
|
assert False,"Unhandled Option"
|
||||||
if not listen and len(target) and port > 0:
|
if not listen and len(target) and port > 0:
|
||||||
3
python/murach-python/.idea/.gitignore
generated
vendored
Normal file
3
python/murach-python/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
6
python/murach-python/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
python/murach-python/.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
4
python/murach-python/.idea/misc.xml
generated
Normal file
4
python/murach-python/.idea/misc.xml
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
||||||
8
python/murach-python/.idea/modules.xml
generated
Normal file
8
python/murach-python/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/murach-python.iml" filepath="$PROJECT_DIR$/.idea/murach-python.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
python/murach-python/.idea/murach-python.iml
generated
Normal file
8
python/murach-python/.idea/murach-python.iml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
6
python/murach-python/.idea/vcs.xml
generated
Normal file
6
python/murach-python/.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
0
python/murach-python/Section3/Chapter18/gui.py
Normal file
0
python/murach-python/Section3/Chapter18/gui.py
Normal file
Loading…
x
Reference in New Issue
Block a user