Skip to content
Permalink
Browse files
Finished minimum functionality for target container
  • Loading branch information
digehode committed Jul 30, 2020
1 parent 9d60e49 commit 845cc67f18ed80e7eacb1a83687685ea4102da46
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 13 deletions.
@@ -12,9 +12,6 @@ COPY web /var/www/html/
RUN sed -i -e 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf
RUN sed -i -e 's/Require all denied/Require all granted/g' /etc/apache2/apache2.conf

#RUN chmod u+x /root/app/starter.sh
#CMD ["/root/app/starter.sh"]

RUN chmod u+x /root/app/starter.sh
RUN chmod u+x /root/app/wydah.py
CMD ["/root/app/wydah.py"]

CMD ["/root/app/starter.sh"]
@@ -12,7 +12,7 @@ do
echo
echo -n "IP: "
ifconfig eth0|grep inet[^6]|cut -d " " -f 10

sleep 3
/root/app/wydah.py
sleep 2
clear
done
@@ -2,27 +2,29 @@
import socket
import random
import os
import select
portOptions=[37000+x*100+x*2 for x in range(9)]
print(portOptions)

port=random.choice(portOptions)
hostname=socket.gethostname()

serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

serversocket.bind((hostname, port))
os.system("""ifconfig eth0|grep inet[^6]|cut -d " " -f 10""")
print(f"Serving on port {port}")
#print(f"Serving on port {port}")

serversocket.listen()
response1=b"57 65 6c 63 6f 6d 65 20 74 6f 20 57 79 64 61 68"



class WydSock:
def __init__(self, sock):
self.sock = sock

def send(self, msg):
if isinstance(msg,str):
msg=str.encode(msg)
self.sock.sendall(msg)

def rcv(self):
@@ -38,12 +40,47 @@ class WydSock:
def close(self):
self.sock.shutdown(socket.SHUT_RDWR)
self.sock.close()

def status(self):

try:
ready_to_read, ready_to_write, in_error = select.select([self.sock,], [self.sock,], [], 5)
return len(ready_to_read)
except select.error:
return False

rdata="Q29uZ3JhdHVsYXRpb25zLCB5b3UgZm91bmQgYSBmbGFnLiAiZmxhZzpoZWF2ZWhvIg=="
while True:

(clientsocket, address) = serversocket.accept()
print(f"Got a connection from {address}")
s=WydSock(clientsocket)
s.send(response1)
s.close()
connected=True
s.send(response1)
while connected:
status=s.status()
if status is False:
connected=False
elif status>0:
data=s.rcv().strip().upper()
print(f"Revieved data: {data}")
if(data==b"CLOSE"):
connected=False
elif data==b"SHADOW":
data="Unable to open"
try:
f = open("/etc/shadow",mode='r')
data = f.read()
f.close()
except Exception as e:
print(e)
data=str(e)
s.send(data)
else:
s.send(rdata)


s.close()
serversocket.shutdown(socket.SHUT_RDWR)
serversocket.close()
break
@@ -1,6 +1,101 @@
<html>
<head><title>Wydah</title></head>
<body>
<iframe width="560" height="315" src="https://www.youtube.com/embed/TZw4M1yHta8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/TZw4M1yHta8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</body>
</html>






























































































<!-- flag:atthebottomoftheocean -->

0 comments on commit 845cc67

Please sign in to comment.