title: How to create Python API or network requests hidden (protected from hackers checking network traffic) on Local Network to manage Computers
body: <p>I know that I can see inside of network traffic for example with WireShark. When i use GET on HTML I can see those stuff in URL, what should not be problem what I am doing. But I believe GET,POST and maybe REQUEST too, as I did not work with that one yet can bee seen on something like Wire Shark network analyzer.</p>
  <p>I am making Python client, what i will put on computers in network to show their IP,Host Name and Users on PC. This client will be as gate to the computer for remote control. As our management does not want to spend money for windows server, or other management system we need to get something free to manage all computers.</p>
  <p>I am also seeking advice how I could do it as you are more skilled then me here.
  I found few ways.</p>
  <ol>
  <li>With the client create SSH Gateway for receiving commands.</li>
  <li>With Client enable the Powershell remote option, then just push scripts to all computers at once.</li>
  <li>Use some way the API requests etc... I am not skilled in this one at all, but I believe this is the way how other similar programs works?</li>
  </ol>
  <p>As this client would create big security risk, I am first seeking way what is best way to hide it from network. Probably I will need to come up with some Private and public Key system here as well.</p>
  <p>What are yours suggestions please on this topic?
  here is just very short code I am playing with to receive basic info as IP, Host name and all Users
  the Flask website showing those values is just for test, It will not be there once it is deployed</p>
  <p><strong>Update</strong>
  I took advice from <code>MarulForFlask</code> but I got a couple issues. First this i think can have only one connection at a time. And second if possible Can i get the output of console from the client PC on screen of Server PC?
  I want this output only for testing, as I know if i do something like netstat or any other command with multiple clients it would filled up screen with too many text... Currently I am getting back text format as plaintext with \r \n ... and other text deviders.</p>
  <p>I am now trying Multicast, but i am getting error for binding the multicast IP.
  <code>OSError: [WinError 10049] The requested address is not valid in its context</code></p>
  <p><strong>Master.py</strong></p>
  <pre><code>import time 
  import socket 
  import sys 
  import os 
  valueExit = True
  
  # Initialize s to socket 
  s = socket.socket() 
  
  # Initialize the host 
  host = socket.gethostname() 
  
  BUFFER_SIZE = 1024
  # Initialize the port 
  port = 8080
  
  # Bind the socket with port and host 
  s.bind(('', port)) 
  
  print(&quot;waiting for connections...&quot;) 
  
  # listening for conections 
  s.listen() 
  
  # accepting the incoming connections 
  conn, addr = s.accept() 
  
  print(addr, &quot;is connected to server&quot;) 
  def send_query(): 
      keepAllive, repeatIt = True, False
      print(&quot;&quot;&quot;To exit session write:    EndSession
      For help write:   help
      &quot;&quot;&quot;)
  
      while (keepAllive == True):
          # commands for server use only
          innerCommands = [&quot;endsession&quot;, &quot;help&quot;]
          # take command as input 
          command = input(str(&quot;Enter Command : &quot;))     
          
          
          if command not in innerCommands:
  
              conn.send(command.encode()) 
  
              print(&quot;Command has been sent successfully.&quot;) 
              keepAllive = False        
              repeatIt = True
  
          elif (command == &quot;endsession&quot;):
              conn.send(command.encode()) 
              valueExit = False            
  
          elif (command == &quot;help&quot;):
              print(&quot;&quot;&quot;To exit session write:    EndSession&quot;&quot;&quot;)
              
  
      while (repeatIt == True):
          # recieve the confrmation 
          data = conn.recv(BUFFER_SIZE) 
  
          if data: 
              print(f&quot;command recieved and executed sucessfully.\n {data}&quot;) 
              keepAllive = True
              repeatIt = False
              
          else:
              print(&quot;No reply from computer&quot;)
              keepAllive = True
              repeatIt = False
  
  while  valueExit == True:
      send_query()
  </code></pre>
  <p><strong>Slave.py</strong></p>
  <pre><code>import time 
  import socket 
  import sys
  import subprocess
  import os
  
  
  stayOn = True
  def establishConnection():
      # Initialize s to socket
      s = socket.socket()
  
      # Initialize the host
      host = &quot;127.0.0.1&quot;
  
      # Initiaze the port
      port = 8080
  
      keepAlive = True
  
      try:
          # bind the socket with port and host
          s.connect((host, port))
          print(&quot;Connected to Server.&quot;)
          while keepAlive == True:
              # recieve the command from master program
              command = s.recv(1024)
              command = command.decode()
              # match the command and execute it on slave system
  
              if command == &quot;endsession&quot;:
                  print(&quot;Program Ended&quot;)
                  keepAlive = False
              elif command != &quot;&quot;:
                  # print(&quot;Command is :&quot;, command)
                  #s.send(&quot;Command recieved&quot;.encode())
  
                  proc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
                  (out, err) = proc.communicate()
                  s.send(f&quot;{out}&quot;.encode())
                  print(&quot;program output:&quot;, out)
  
  
  
  
      except Exception as err:
          print(f&quot;Error: {err}&quot;)
          s.send(f&quot;Error: {err}&quot;.encode())
  
  
  while stayOn == True:
      establishConnection()
  </code></pre>