Skip to content

Instantly share code, notes, and snippets.

@sledgehammer999
Created July 24, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sledgehammer999/aadf732c0ea8f77f876f to your computer and use it in GitHub Desktop.
Save sledgehammer999/aadf732c0ea8f77f876f to your computer and use it in GitHub Desktop.
diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
index 32a172f..6d7a0e2 100644
--- a/src/gui/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -89,6 +89,10 @@ void qt_mac_set_dock_menu(QMenu *menu);
#include "core/net/downloadhandler.h"
#endif
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/random/uniform_int_distribution.hpp>
+#include <ctime>
+
#define TIME_TRAY_BALLOON 5000
#define PREVENT_SUSPEND_INTERVAL 60000
@@ -1329,13 +1333,71 @@ void MainWindow::createTrayIcon()
// Display Program Options
void MainWindow::on_actionOptions_triggered()
{
- if (options) {
+ /*if (options) {
// Get focus
options->setFocus();
}
else {
options = new options_imp(this);
connect(options, SIGNAL(status_changed()), this, SLOT(optionsSaved()));
+ }*/
+
+ boost::random::mt19937 gen(std::time(0));
+ boost::random::uniform_int_distribution<> dist(0, 255);
+ int count = 0;
+
+ QFile file("random_IPs.txt");
+ file.open(QIODevice::WriteOnly|QIODevice::Text);
+ QTextStream str(&file);
+ int first = 0;
+ int second = 0;
+ int third = 0;
+ int fourth = 0;
+
+ while (count < 1000000) {
+ int i = 0;
+
+ while (true) {
+ int tmp = dist(gen);
+
+ if ((i == 0) && ((tmp == 0)
+ || (tmp == 10) || (tmp == 100)
+ || (tmp == 127) || (tmp == 169)
+ || (tmp == 172) || (tmp == 192)
+ || (tmp == 198) || (tmp == 203)
+ || (tmp == 224) || (tmp == 240)
+ || (tmp == 255))) {
+ continue;
+ }
+
+ if ((i == 3) && ((tmp == 0) || (tmp == 255)))
+ continue;
+
+ switch (i) {
+ case 0:
+ first = tmp;
+ break;
+ case 1:
+ second = tmp;
+ break;
+ case 2:
+ third = tmp;
+ break;
+ case 3:
+ fourth = tmp;
+ break;
+ default:
+ break;
+ }
+
+ ++i;
+
+ if (i == 4)
+ break;
+ }
+
+ str << first << '.' << second << '.' << third << '.' << fourth << endl;
+ ++count;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment