Advertisement
Yattaze

Ip-Gen Source Code

Jun 24th, 2016
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.95 KB | None | 0 0
  1. // IpGen.cpp : Defines the entry point for the console application.
  2. #include "stdafx.h"
  3. #include <stdlib.h>  
  4. #include <time.h>      
  5. #include <iostream>
  6. #include <string>
  7. #include <fstream>
  8.  
  9. using namespace std;
  10.  
  11. void Splash();
  12.  
  13. string temp;
  14. string ip;
  15. string dot = ".";
  16. int max;
  17. int counter = 0;
  18. int counter1 = 1;
  19. bool nmap = false;
  20.  
  21. int main()
  22. {
  23.     Splash();
  24.     cout << "How many ips do you want to find\n>";
  25.     cin >> max;
  26.     cout << "Do you have nmap installed?  (y/n)\n>";
  27.     cin >> temp;
  28.     if (temp == "y" || temp == "Y")
  29.     {
  30.         nmap = true;
  31.         temp == "";
  32.     }
  33.     else
  34.     {
  35.         nmap = false;
  36.         temp == "";
  37.     }
  38.     system("cls");
  39.     srand(time(NULL));
  40.     while (counter != max)
  41.     {
  42.         int random0 = (rand() % (0 - 255)) + 1;
  43.         int random1 = (rand() % (0 - 255)) + 1;
  44.         int random2 = (rand() % (0 - 255)) + 1;
  45.         int random3 = (rand() % (0 - 255)) + 1;
  46.         ip = std::to_string(random0) + dot + std::to_string(random1) + dot + std::to_string(random2) + dot + std::to_string(random3);
  47.         Splash();
  48.         cout << "\n\t\t---------------------------------\n";
  49.         cout << "\t\tTry(" << counter1 << ")" << "\t       Found(" << counter << ")\n\t\tIp Generated : " << ip;
  50.         cout << "\n\t\t---------------------------------";
  51.         string cmd = "ping " + ip;
  52.         int result = system(cmd.c_str());
  53.         if (result == 0)
  54.         {
  55.             //Device Connected
  56.             counter++;
  57.             cout << "\n\t\t---------------------------------";
  58.             cout << "\n\t\tDevice Connected";
  59.             cout << "\n\t\t---------------------------------\n\n";
  60.             ofstream Connected;
  61.             Connected.open("Generated_Ips.txt", ios::out | ios::app);
  62.             Connected << ip << "\n";
  63.             Connected.close();
  64.             system("cls");
  65.         }
  66.         else
  67.         {
  68.             //Device Disconnected
  69.             cout << "\n\t\t---------------------------------";
  70.             cout << "\n\t\tDevice Disconnected";
  71.             cout << "\n\t\t---------------------------------\n\n";
  72.             system("cls");
  73.         }
  74.         counter1++;
  75.     }
  76.     if (nmap == true)
  77.     {
  78.         system("nmap -oN output.txt -iL Generated_Ips.txt");
  79.     }
  80.     else
  81.     {
  82.         //do nothing
  83.     }
  84.     cout << "Found " << max << " ips";
  85.     cin >> temp;
  86.     return 0;
  87. }
  88.  
  89. void Splash()
  90. {
  91.     cout << "Yattaze's\n";
  92.     cout << "\t8888888                  .d8888b.                    \n";
  93.     cout << "\t  888                   d88P  Y88b                   \n";
  94.     cout << "\t  888                   888    888                   \n";
  95.     cout << "\t  888   88888b.         888         .d88b.  88888b.  \n";
  96.     cout << "\t  888   888  88b        888  88888 d8P  Y8b 888 88b \n";
  97.     cout << "\t  888   888  888 888888 888    888 88888888 888  888 \n";
  98.     cout << "\t  888   888 d88P        Y88b  d88P Y8b.     888  888 \n";
  99.     cout << "\t8888888 88888P             Y8888P88  Y8888  888  888 \n";
  100.     cout << "\t        88                                           \n";
  101.     cout << "\t        88                                           \n";
  102.     cout << "\t        88                                           \n\n";
  103.     cout << "--------01001001 01110000 00101101 01000111 01100101 01101110--------\n\n";
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement