feature(http): Add feature to return just the raw IP for shell scripts
This commit is contained in:
parent
ebd866659e
commit
e70a3c2160
1 changed files with 4 additions and 0 deletions
|
@ -17,6 +17,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import socket
|
import socket
|
||||||
|
import json
|
||||||
import jinja2
|
import jinja2
|
||||||
import paramiko
|
import paramiko
|
||||||
import threading
|
import threading
|
||||||
|
@ -240,6 +241,9 @@ def http_talker(client, valdict, proto="http"):
|
||||||
valdict.update({"proto": proto})
|
valdict.update({"proto": proto})
|
||||||
log(j2format(j2log, valdict))
|
log(j2format(j2log, valdict))
|
||||||
response_body_raw = j2format(j2send, valdict)+"\n"
|
response_body_raw = j2format(j2send, valdict)+"\n"
|
||||||
|
if request_lines[0].split()[1] == "/raw":
|
||||||
|
json_content = json.loads(response_body_raw)
|
||||||
|
response_body_raw = json_content['ip']
|
||||||
response_headers_raw = """HTTP/1.1 200 OK
|
response_headers_raw = """HTTP/1.1 200 OK
|
||||||
Content-Length: %s
|
Content-Length: %s
|
||||||
Content-Type: application/json; encoding=utf8
|
Content-Type: application/json; encoding=utf8
|
||||||
|
|
Loading…
Reference in a new issue