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).

1  
!752
2  
3  
static double sleepTime = 10; // seconds
4  
5  
concepts.
6  
7  
concept IP {
8  
  S ip;
9  
  bool myIP, aware;
10  
  long lastCheck, lastSeenAware;
11  
  S computerID;
12  
  new Set<S> pastComputerIDs;
13  
}
14  
15  
concept SuccessfulProxyContact {
16  
  S proxy, target;
17  
  long lastSuccess;
18  
  S targetComputerID;
19  
}
20  
21  
static L<IP> aware;
22  
23  
p {
24  
  conceptsAndBot();
25  
  Concepts in = new Concepts("#1006041").load(); // Information Gatherer
26  
  
27  
  aware = findConcepts(in, IP, aware := true);
28  
  print("Aware computers I can see: " + struct(collect(aware, "ip")));
29  
  L<IP> unaware = findConcepts(in, IP, aware := false);
30  
  print("Computers I could try to proxy-contact: " + struct(collect(unaware, "ip")));
31  
  
32  
  for (IP ip : unaware)
33  
    tryToContact(ip.ip);
34  
}
35  
36  
svoid tryToContact(S target) {
37  
  for (IP proxy : aware) pcall {
38  
    print("Trying to contact " + target + " through " + proxy.ip);
39  
    long time = now();
40  
    S answer = sendToPublicCommBotThroughProxy(proxy.ip, target, "test");
41  
    print("  Answer: " + answer);
42  
    if (match("test", answer)) {
43  
      print("  Success!!\n");
44  
      SuccessfulProxyContact contact = uniq(SuccessfulProxyContact, proxy := proxy.ip, +target);
45  
      cset(contact, lastSuccess := time);
46  
      answer = sendToPublicCommBotThroughProxy(proxy.ip, target, forward("Awareness", "get computer id"));
47  
      S computerID = matchOK(answer);
48  
      if (computerID != null)
49  
        cset(contact, targetComputerID := computerID);
50  
      break;
51  
    }
52  
  }
53  
}

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: 416 / 523
Referenced in: [show references]