mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-06 09:51:06 +00:00
Update server.py, assets/php/index.php
This commit is contained in:
parent
1ceee29dba
commit
c38952d301
|
@ -9,12 +9,16 @@
|
||||||
* Updated at: 2024-06-20
|
* Updated at: 2024-06-20
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("PHP_HTTPPROXY_VERSION", "0.1.5.17");
|
define("PHP_HTTPPROXY_VERSION", "0.1.5.18");
|
||||||
define("DEFAULT_SOCKET_TIMEOUT", 1);
|
define("DEFAULT_SOCKET_TIMEOUT", 1);
|
||||||
define("STATEFUL_SOCKET_TIMEOUT", 30);
|
define("STATEFUL_SOCKET_TIMEOUT", 30);
|
||||||
define("MAX_EXECUTION_TIME", 0);
|
define("MAX_EXECUTION_TIME", 0);
|
||||||
|
|
||||||
if (strpos($_SERVER['HTTP_USER_AGENT'], "php-httpproxy/") !== 0) {
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
header('Access-Control-Allow-Methods: *');
|
||||||
|
header("Access-Control-Allow-Headers: *");
|
||||||
|
|
||||||
|
if (strpos($_SERVER['HTTP_USER_AGENT'], "php-httpproxy/") !== 0 && strpos($_SERVER['HTTP_X_USER_AGENT'], "php-httpproxy/") !== 0) {
|
||||||
exit('<!DOCTYPE html><html><head><title>It works!</title><meta charset="utf-8"></head><body><h1>It works!</h1><p><a href="https://github.com/gnh1201/caterpillar">Download the client</a></p><p>' . $_SERVER['HTTP_USER_AGENT'] . '</p><hr><p>php-httpproxy/' . PHP_HTTPPROXY_VERSION . ' (Server; PHP ' . phpversion() . '; Caterpillar; abuse@catswords.net)</p></body></html>');
|
exit('<!DOCTYPE html><html><head><title>It works!</title><meta charset="utf-8"></head><body><h1>It works!</h1><p><a href="https://github.com/gnh1201/caterpillar">Download the client</a></p><p>' . $_SERVER['HTTP_USER_AGENT'] . '</p><hr><p>php-httpproxy/' . PHP_HTTPPROXY_VERSION . ' (Server; PHP ' . phpversion() . '; Caterpillar; abuse@catswords.net)</p></body></html>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,15 +306,21 @@ function relay_sendmail($params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function relay_get_version() {
|
function relay_get_version() {
|
||||||
return PHP_HTTPPROXY_VERSION;
|
return array(
|
||||||
|
"data" => PHP_HTTPPROXY_VERSION;
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function relay_get_phpversion() {
|
function relay_get_phpversion() {
|
||||||
return phpversion();
|
return array(
|
||||||
|
"data" => phpversion()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function relay_get_loaded_extensions() {
|
function relay_get_loaded_extensions() {
|
||||||
return get_loaded_extensions();
|
return array(
|
||||||
|
"data" => get_loaded_extensions()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function relay_dns_get_record($params) {
|
function relay_dns_get_record($params) {
|
||||||
|
@ -406,7 +416,10 @@ function get_client_address() {
|
||||||
} else {
|
} else {
|
||||||
$client_address = $_SERVER['REMOTE_ADDR'];
|
$client_address = $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
return array("client_address" => $client_address);
|
return array(
|
||||||
|
"data" => $client_address,
|
||||||
|
"client_address" => $client_address // compatible under version 0.1.5.18
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse a context
|
// parse a context
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
# Namyheon Go (Catswords Research) <gnh1201@gmail.com>
|
||||||
# https://github.com/gnh1201/caterpillar
|
# https://github.com/gnh1201/caterpillar
|
||||||
# Created at: 2022-10-06
|
# Created at: 2022-10-06
|
||||||
# Updated at: 2024-05-20
|
# Updated at: 2024-06-20
|
||||||
#
|
#
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -352,8 +352,8 @@ def proxy_server(webserver, port, scheme, method, url, conn, addr, data):
|
||||||
query = requests.post(server_url, headers=proxy_data['headers'], data=query_data, timeout=1, auth=auth)
|
query = requests.post(server_url, headers=proxy_data['headers'], data=query_data, timeout=1, auth=auth)
|
||||||
if query.status_code == 200:
|
if query.status_code == 200:
|
||||||
result = query.json()['result']
|
result = query.json()['result']
|
||||||
resolved_address_list.append(result['client_address'])
|
resolved_address_list.append(result['data'])
|
||||||
print ("[*] resolved IP: %s" % (result['client_address']))
|
print ("[*] resolved IP: %s" % (result['data']))
|
||||||
except requests.exceptions.ReadTimeout as e:
|
except requests.exceptions.ReadTimeout as e:
|
||||||
pass
|
pass
|
||||||
proxy_data['data']['client_address'] = resolved_address_list[0]
|
proxy_data['data']['client_address'] = resolved_address_list[0]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user