Last active
July 9, 2020 22:11
-
-
Save morontt/43ea349c508a1194a3d9c2baddd2f2a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ip_addresses_*.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$generator = (function () { | |
do { | |
$hash = sha1(microtime()); | |
for ($i = 0; $i < 5; $i++) { | |
yield sprintf( | |
'%d.%d.%d.%d', | |
hexdec(substr($hash, $i * 8, 2)), | |
hexdec(substr($hash, $i * 8 + 2, 2)), | |
hexdec(substr($hash, $i * 8 + 4, 2)), | |
hexdec(substr($hash, $i * 8 + 6, 2)) | |
); | |
} | |
} while (true); | |
})(); | |
$fp = fopen(sprintf('ip_addresses_%d.txt', date('U')), 'w'); | |
$cnt = 0; | |
while ($cnt < 10000) { | |
$ip = $generator->current(); | |
fwrite($fp, $ip . "\n"); | |
$generator->next(); | |
$cnt++; | |
} | |
fclose($fp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment