Guest
Public paste!

Untitled

By: a guest | Sep 9th, 2010 | Syntax: None | Size: 1.96 KB | Hits: 16 | Expires: Never
Copy text to clipboard
  1. void sendMessage(string host, string text) {
  2.     message(host, text);
  3. }
  4.  
  5. void launchAttack(string myPort, string targetIP, string targetPort) {
  6.     attack(myPort, targetIP, targetPort);
  7.     sendMessage("169.255.8.149", "Attack launched.");
  8. }
  9.  
  10. //Cut a string until the delimiter. Used primarily to remove line feeds.
  11. string snippet(string text, string delimiter) {
  12.     text = substr(text, 0, indexOf(text, delimiter, 0));
  13.     return text;
  14. }
  15.  
  16. //Fetch our list of addresses, and return in a space separated string
  17. string getList(string conf) {
  18.     string configFile = getGlobal(0)+"";
  19.     string listOut = "";
  20.     string setting = "";
  21.     string settingArr[];
  22.    
  23.     int configLen = countLines(configFile);
  24.     int i;
  25.    
  26.     for(i = 0; i < configLen; i++) {
  27.         setting = readLine(configFile, i);
  28.         if(strlen(setting) > 1) {
  29.             setting = snippet(setting, ";");
  30.             settingArr[] = split(setting, ":");
  31.             if(settingArr[0] == conf) {
  32.                 listOut += settingArr[1] + ":" + settingArr[2] + char(32);
  33.             }
  34.         }
  35.        
  36.     }
  37.    
  38.    return listOut;
  39. }
  40.  
  41. int main(){
  42.     string myport[];
  43.     string myports = getList("attackPort");
  44.     string target[];
  45.     string targets = getList("attackTarget");
  46.    
  47.     string myportsArr[] = split(zombies, char(32));
  48.     string targetsArr[] = split(targets, char(32));
  49.    
  50.     int myportLen = length(myportsArr[]);
  51.     int targetLen = length(targetsArr[]);
  52.     int targetOpt = 0;
  53.    
  54.     int i = 0;
  55.    
  56.     for(i = 0; i < myportLen; i++) {
  57.         //If we run out of targets, take it from the top.
  58.         if(targetLen == 1) {
  59.             targetOpt = 0;
  60.         } else if(targetLen < i) {
  61.             targetOpt = 0;
  62.         }
  63.         myport[] = split(myportsArr[i], ":");
  64.         target[] = split(targetsArr[targetOpt], ":");
  65.         targetOpt++;
  66.        
  67.         launchAttack(parseInt(myport[0]), target[0], parseInt(target[1]));
  68.     }
  69.    
  70. }