@@ -35,8 +35,9 @@ protected function execute(
3535 ): int {
3636 $ this ->logger = new Logger ($ output );
3737
38- // XHProf
39- $ this ->sendContent ('yii-xhprof.http ' );
38+ $ this ->mail2 ($ output , true );
39+ // $this->sendContent('yii-xhprof.http');
40+ die;
4041
4142 $ this ->dump ();
4243 \usleep (100_000 );
@@ -59,6 +60,17 @@ private function dump(): void
5960 $ _SERVER ['VAR_DUMPER_FORMAT ' ] = 'server ' ;
6061 $ _SERVER ['VAR_DUMPER_SERVER ' ] = "$ this ->addr : $ this ->port " ;
6162
63+ trap (
64+ index: \substr (\file_get_contents (__FILE__ ), 0 , 312 ),
65+ )->code (
66+ syntax: 'php ' ,
67+ // editable: true,
68+ // decorated: 'twitter',
69+ // theme: 'dark',
70+ );
71+
72+ trap (fuck: true );
73+
6274 trap (['foo ' => 'bar ' ]);
6375 trap (123 );
6476 trap (new \DateTimeImmutable ());
@@ -94,6 +106,36 @@ private function dump(): void
94106 }
95107 }
96108
109+ private function mail2 (OutputInterface $ output , bool $ multipart = false ): void
110+ {
111+ try {
112+ $ socket = \socket_create (AF_INET , SOCK_STREAM , SOL_TCP );
113+ \socket_connect ($ socket , $ this ->addr , $ this ->port );
114+
115+ $ this ->sendMailPackage ($ output , $ socket , '' , '220 ' );
116+ $ this ->sendMailPackage ($ output , $ socket , "HELO \r\n" , '250 ' );
117+ $ this ->
sendMailPackage (
$ output,
$ socket,
"MAIL FROM: <[email protected] > \r\n" ,
'250 ' );
118+ $ this ->
sendMailPackage (
$ output,
$ socket,
"RCPT TO: <[email protected] > \r\n" ,
'250 ' );
119+ $ this ->
sendMailPackage (
$ output,
$ socket,
"RCPT TO: <[email protected] > \r\n" ,
'250 ' );
120+ $ this ->sendMailPackage ($ output , $ socket , "DATA \r\n" , '354 ' );
121+
122+ $ this ->sendMailPackage (
123+ $ output ,
124+ $ socket ,
125+ \file_get_contents (Info::TRAP_ROOT . '/resources/payloads/yii-mail.http ' ),
126+ '250 ' ,
127+ );
128+
129+ // End of data
130+ $ this ->sendMailPackage ($ output , $ socket , "QUIT \r\n" , '221 ' );
131+
132+ \socket_close ($ socket );
133+
134+ } catch (\Throwable $ e ) {
135+ $ this ->logger ->exception ($ e , 'Mail protocol error ' , important: true );
136+ }
137+ }
138+
97139 private function mail (OutputInterface $ output , bool $ multipart = false ): void
98140 {
99141 try {
@@ -141,7 +183,26 @@ private function mail(OutputInterface $output, bool $multipart = false): void
141183 $ this ->sendMailPackage (
142184 $ output ,
143185 $ socket ,
144- "<p>This is what displays in most modern email clients</p> \r\n" ,
186+ '<img src="cid:4486bda9ad8b1f422deaf6a750194668@trap"> '
187+ . "<p>This is what displays in most modern email clients</p> \r\n" ,
188+ '' ,
189+ );
190+ $ this ->sendMailPackage ($ output , $ socket , "\r\n" , '' );
191+ $ this ->sendMailPackage ($ output , $ socket , "--boundary-string-- \r\n" , '' );
192+ // Image
193+ $ this ->sendMailPackage (
194+ $ output ,
195+ $ socket ,
196+ "Content-Type: image/png; name=4486bda9ad8b1f422deaf6a750194668@trap \r\n" ,
197+ '' ,
198+ );
199+ $ this ->sendMailPackage ($ output , $ socket , "Content-Transfer-Encoding: base64 \r\n" , '' );
200+ $ this ->sendMailPackage ($ output , $ socket , "Content-Disposition: inline; name= \"4486bda9ad8b1f422deaf6a750194668@trap \"; filename=logo-embeddable \r\n" , '' );
201+ $ this ->sendMailPackage ($ output , $ socket , "\r\n" , '' );
202+ $ this ->sendMailPackage (
203+ $ output ,
204+ $ socket ,
205+ \base64_encode (\file_get_contents (Info::TRAP_ROOT . '/resources/payloads/logo.png ' )) . "\r\n" ,
145206 '' ,
146207 );
147208 $ this ->sendMailPackage ($ output , $ socket , "\r\n" , '' );
0 commit comments