-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSEC_SSY.php
More file actions
115 lines (87 loc) · 2.95 KB
/
SEC_SSY.php
File metadata and controls
115 lines (87 loc) · 2.95 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
// SEC_SSY - Security and Encryption Classes
* Date: 1/27/2019
*/
// https://en.wikipedia.org/wiki/Quantum_key_distribution#SECOQC
// ~J/270119
class QKD {
private $qbit, $qkd;
function LQTM()
{
// linear quantum turing machine
$simulator = "LQTM";
$this->qbit = QASM_init();
QASM_setopt( $this->qbit, QASM_SIM, $simulator);
}
}
// https://www.npmjs.com/package/quantum-circuit
// https://quantum-circuit.com/
// http://web.archive.org/web/20011207175140/http://www.cs.caltech.edu/~thoth/QTMConfig.lsp
// http://web.archive.org/web/20011207175140/http://www.cs.caltech.edu/~thoth/QTM.lsp
// http://web.archive.org/web/20011207175140/http://www.cs.caltech.edu/~thoth/QTMexamples.lsp
// Install Apache, PHP, CURL & Tor with apt-get
// sudo apt-get install -y apache2 php5 php5-curl tor
class PROXY {
private $ch, $proxy;
function __construct()
{
// $torSocks5Proxy = "socks5://127.0.0.1:9050";
// direct connection
$torSocks5Proxy = "127.0.0.1:9050";
$this->ch = curl_init();
//curl_setopt( $this->ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5 );
curl_setopt( $this->ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME );
curl_setopt( $this->ch, CURLOPT_PROXY, $torSocks5Proxy );
curl_setopt( $this->ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $this->ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $this->ch, CURLOPT_RETURNTRANSFER, false );
curl_setopt( $this->ch, CURLOPT_HEADER, false );
}
public function curl( $url, $postParameter = null )
{
if( sizeof( $postParameter ) > 0 )
curl_setopt( $this->ch, CURLOPT_POSTFIELDS, $postParameter );
curl_setopt( $this->ch, CURLOPT_URL, $url );
return curl_exec( $this->ch );
}
public function changeProxyIdentity()
{
$ip = '127.0.0.1';
$port = '9050';
$fp = fsockopen(
$ip, $port,
$error_number,
$err_string, 10
);
if (!$fp) {
echo "Error while changing Tor proxy identity: {$error_number} : {$err_string}";
return false;
} else {
fwrite($fp, "AUTHENTICATE\n");
$received = fread($fp, 512);
fwrite($fp, "signal NEWNY\n");
$received = fread($fp, 512);
}
fclose($fp);
return $received;
}
function __destruct()
{
curl_close( $this->ch );
}
}
/*
* Use the PROXY class for a GET request.
$proxy = new PROXY();
$proxy->changeProxyIdentity();
echo $proxy->curl( "http://check.torproject.org" );
* Use the Proxy class for a POST request
$proxy = new PROXY();
$parameter = array(
'parameter1' => 'value1',
'parameter2' => 'value2'
);
echo $proxy->curl( "http://check.torproject.org", $parameter );
*/
?>