· 8 years ago · Jul 14, 2018, 11:54 PM
1<?php
2
3if (isset($_POST['email'], $_POST['name'], $_POST['amount'])){
4
5
6 $target_email = $_POST['email'];
7 $target_name = $_POST['name'];
8 $target_amount = $_POST['amount'];
9
10 $surnames = explode(PHP_EOL, readFromFile("surnames.txt"));
11 $names = explode(PHP_EOL, readFromFile("names.txt"));
12 $email_prov = array("aol.com", "gmail.com", "googlemail.com", "hotmal.com", "yahoo.com", "live.com");
13
14 //Hardcoded values
15 $topics_a = array("","The", "Your", "My", "Our", "The neighbours", "Trumps", "Obamas", "Americas");
16 $pers = array("nobody","somebody","you","i","we","the neighbours","trump","obama","america");
17 $pers_Verb = array("has","has","have","have","have","have","has","has","has");
18 $topics_b = array("party", "baby", "kid", "house", "smartphone", "computer", "dog", "cat", "music", "internet access", "speach", "racist slurs", "weekend trip", "new neighbours", "clown", "movie", "horror movie", "cinema", "last wish", "last will", "cancer", "HIV infection", "tolerance", "peace");
19
20 $var_verb1 = array("talked about", "spoken about", "discussed", "mentioned", "thought about", "written about", "posted about", "shared", "appeared to love", "appeared to hate");
21
22 $greetings = array("Hello", "Good day", "Hi", "Dear", "Greetings");
23
24 $text1 = array("it has come to my attention that <pers2> <pers2_verb> <var_verb1> <topic>.", "i was told that yesterday <pers2> <pers2_verb> <var_verb1> <topic>.", "yesterday <pers2> <pers2_verb> <var_verb1> <topic>.", "i received an email from <pers2> about <topic>.");
25
26 $text2 = array("We might have had different opinions about this topic, but i hope we can continue to be friends.", "I'd really like to hear your thoughts about this.", "I wondered what you'd have to say about this.", "I'm interested what your opinion regarding this topic is.");
27
28 $goodbye = array("Sincerly", "Love", "Kind regards", "Regards");
29
30 for ($x = 0; $x <= $target_amount; $x++) {
31
32 $name1 = randomEntry($names);
33 $name2 = randomEntry($surnames);
34
35
36 if (rand(1,100)<50){
37 $email_suff = rand(1,1000);
38 }
39
40 $email = $name1 . "." . $name2 . $email_suff . "@" . randomEntry($email_prov);
41 $completFrom = $name1 . " " . $name2 . " <" . $email . ">";
42
43 $header = 'From: ' . $completFrom . "\r\n" .
44 'Reply-To: ' . $email . "\r\n" .
45 'X-Mailer: PHP/' . phpversion();
46
47 $text = randomEntry($greetings) . " " . $target_name . ", \n\n" . randomEntry($text1) . "\n" . randomEntry($text2) . "\n\n" . randomEntry($goodbye) . " " . $name1;
48
49 $pers2_ind = rand(1,count($pers))-1;
50
51 $topic_a = randomEntry($topics_a);
52 $topic_b = randomEntry($topics_b);
53 $topic = $topic_a . " " . $topic_b;
54
55 $text = str_replace ("<pers2>" , $pers[$pers2_ind] , $text);
56 $text = str_replace ("<pers2_verb>" , $pers_Verb[$pers2_ind] , $text);
57 $text = str_replace ("<var_verb1>" , randomEntry($var_verb1) , $text);
58 $text = str_replace ("<topic>" , $topic , $text);
59
60 mail($target_email, $topic, $text, $header);
61 }
62
63 echo "<html><body>";
64
65 echo "\nEmail an " . $target_email . " geschickt. (" . phpversion() . ")";
66
67 echo "</body></html>";
68
69}else{
70 ?>
71 <form action="" method="post">
72 Email spam:<br /><br />
73 Name: <input type="text" name="name">
74 Email: <input type="text" name="email">
75 Amount: <input type="number" name="amount" min="1" max="100">
76 <input type="submit" name="submit" value="Spam">
77 </form>
78 <?php
79}
80
81function randomEntry($array){
82 return $array[rand(1,count($array))-1];
83}
84
85function readFromFile($filename){
86 echo '\nRead from ' . $filename;
87 $file = fopen($filename, "r") or die("Unable to open file " . $filename . "!");
88 $fileContent = fread($file,filesize($filename));
89 fclose($file);
90 return $fileContent;
91}
92
93?>