#!/usr/bin/env python3
import sys
import pickle
import socket


def pack():
    ip = sys.argv[1]
    try:
        data = sys.argv[2:]
    except:
        data = "NO DATA SPECIFIED"

    nudge(pickle.dumps({"ip": ip, "data": data}))


def nudge(data):
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect(("localhost", 45678))
    s.send(data)
    s.close()

if __name__ == "__main__" and len(sys.argv) > 1:
    pack()

@@ -76,20 +76,17 @@
 ack():%0D%0A
-    
+%09
 ip = sys
@@ -99,26 +99,17 @@
 1%5D%0D%0A
-    
+%09
 try:%0D%0A
-        
+%09%09
 data
@@ -125,20 +125,17 @@
 gv%5B2:%5D%0D%0A
-    
+%09
 except:%0D
@@ -139,16 +139,10 @@
 t:%0D%0A
-        
+%09%09
 data
@@ -167,20 +167,17 @@
 IED%22%0D%0A%0D%0A
-    
+%09
 nudge(pi
@@ -237,20 +237,17 @@
 data):%0D%0A
-    
+%09
 s = sock
@@ -293,20 +293,17 @@
 TREAM)%0D%0A
-    
+%09
 s.connec
@@ -327,20 +327,17 @@
 5678))%0D%0A
-    
+%09
 s.send(d
@@ -342,20 +342,17 @@
 (data)%0D%0A
-    
+%09
 s.close(
@@ -410,12 +410,9 @@
 1:%0D%0A
-    
+%09
 pack

Update nudge.py