Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

53
LINES

< > BotCompany Repo | #1006044 // Try to contact computers invisible to me through proxy [outdated, now part of #1006041]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (6757L/45K/152K).

!752

static double sleepTime = 10; // seconds

concepts.

concept IP {
  S ip;
  bool myIP, aware;
  long lastCheck, lastSeenAware;
  S computerID;
  new Set<S> pastComputerIDs;
}

concept SuccessfulProxyContact {
  S proxy, target;
  long lastSuccess;
  S targetComputerID;
}

static L<IP> aware;

p {
  conceptsAndBot();
  Concepts in = new Concepts("#1006041").load(); // Information Gatherer
  
  aware = findConcepts(in, IP, aware := true);
  print("Aware computers I can see: " + struct(collect(aware, "ip")));
  L<IP> unaware = findConcepts(in, IP, aware := false);
  print("Computers I could try to proxy-contact: " + struct(collect(unaware, "ip")));
  
  for (IP ip : unaware)
    tryToContact(ip.ip);
}

svoid tryToContact(S target) {
  for (IP proxy : aware) pcall {
    print("Trying to contact " + target + " through " + proxy.ip);
    long time = now();
    S answer = sendToPublicCommBotThroughProxy(proxy.ip, target, "test");
    print("  Answer: " + answer);
    if (match("test", answer)) {
      print("  Success!!\n");
      SuccessfulProxyContact contact = uniq(SuccessfulProxyContact, proxy := proxy.ip, +target);
      cset(contact, lastSuccess := time);
      answer = sendToPublicCommBotThroughProxy(proxy.ip, target, forward("Awareness", "get computer id"));
      S computerID = matchOK(answer);
      if (computerID != null)
        cset(contact, targetComputerID := computerID);
      break;
    }
  }
}

Author comment

Began life as a copy of #1006041

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006044
Snippet name: Try to contact computers invisible to me through proxy [outdated, now part of #1006041]
Eternal ID of this version: #1006044/1
Text MD5: 427dbf6486fcbb4effaecf94d2286cfb
Transpilation MD5: 3c1f0c55cd2eb9cc2bbefe0b50f183b1
Author: stefan
Category: javax / networking
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-15 14:54:05
Source code size: 1485 bytes / 53 lines
Pitched / IR pitched: No / No
Views / Downloads: 414 / 521
Referenced in: [show references]