-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
44 lines (28 loc) · 909 Bytes
/
index.php
File metadata and controls
44 lines (28 loc) · 909 Bytes
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
<?php
$my_address = '127.0.0.1';
$my_port = "8882";
$headers = apache_request_headers();
$target = $headers["Host2"];
$id = $headers["Id"];
$remote = stream_socket_client("tcp://".gethostbyname($target).":443");
$user = stream_socket_client("tcp://".$my_address.":".$my_port);
fwrite($user, $id);
stream_set_blocking($remote, false); // Trying to be async
stream_set_blocking($user, false);
$data_rem = "";
$data_user = "";
while(1) {
$data_rem = fread($remote, 2000); /* If there ANY data (up to len), reads ALL data,
if there NO data, returns NOTHING */
$data_user = fread($user, 2000);
if(strlen($data_rem)) {
error_log('data_rem');
fwrite($user, $data_rem);
$data_rem = "";
}
if(strlen($data_user)) {
error_log('data_user');
fwrite($remote, $data_user);
$data_user = "";
}
}