forked from zedsec390/NJElib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjcl.py
More file actions
executable file
·73 lines (63 loc) · 1.92 KB
/
jcl.py
File metadata and controls
executable file
·73 lines (63 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python3.12
#
# Executes the JCL provided in the first argument
# as the user provided as the second argument
# and displays the information/contents to stdout
# By Philip Young (c) 2016
# MIT License
#
# From BeS TODO: (2024-02-15)
# need to implement args better
# need to implement port argument
# need to implement debug argument
import njelib
import sys
NJEport = 175
if len(sys.argv) < 6:
print('Usage: ./jcl.py OHOST RHOST ip filname username [password]')
sys.exit(-1)
print("[+] OHOST:", sys.argv[1])
print("[+] RHOST:", sys.argv[2])
print("[+] IP :", sys.argv[3])
print("[+] File :", sys.argv[4])
print("[+] User :", sys.argv[5])
if len(sys.argv) > 6:
print("[+] Pass :", sys.argv[6])
pwd = sys.argv[6]
else:
pwd = ''
nje = njelib.NJE(sys.argv[2],sys.argv[1])
##
# uncomment for debug
##
#nje.set_debuglevel(1)
t = nje.session(host=sys.argv[3],port=NJEport, timeout=2, password=pwd)
# Notice the use of the password here to connect.
if not t:
print("[!] Could not connect")
sys.exit(1)
print("[+] Connected")
print("===================")
print("[+] Sending file:", sys.argv[4])
with open (sys.argv[4], "r") as myfile:
data=myfile.readlines()
print("---------10--------20--------30---------40---------50---------60---------70---------80\n")
for l in data:
print(l.strip("\n"))
print("\n---------10--------20--------30---------40---------50---------60---------70---------80")
nje.sendJCL(sys.argv[4], sys.argv[5])
print("===================")
print("[+] Response Received")
if len(nje.getNMR()) > 0:
print("[+] NMR Records")
print("===================")
for record in nje.getNMR():
if 'NMRUSER' in record:
print("[+] User Message")
print("[+] To User:", record['NMRUSER'])
print("[+] Message:", record['NMRMSG'])
print("===================")
print("[+] Records in SYSOUT:")
for record in nje.getSYSOUT():
if 'Record' in record:
print(record['Record'].decode('ascii'))