Last visit was: It is currently Thu Mar 28, 2024 3:10 pm


All times are UTC-05:00




Post new topic Reply to topic  [20 posts ] 
Author Message
 Post subject:OnlinkLogNuker
PostPosted:Sun May 02, 2010 11:45 am 
 

Joined:Mon Feb 16, 2009 12:42 am
Posts:11
I noticed that the onlink game is always lack of memory. In some previous post, I guessed this is because of the action without a mission, finally I discover it's because of the lack of memory. Why onlink need so many memory? I think it's because of the huge amount of logs. To gain more time before the server disconnect you, you must bounce as many nodes as possible. And to crack the ACS, you need at least 40 clients online. The "40" is derived from my imagination, now there is 36 clients on line, I still can't DDos the ACS. This cause the log information occupy more than 80% of the save file while I don't think they are useful. So I write a program to erase log from your save file. The memory before I do this used by onlink is 240MB while 75MB after I erasing logs. The code below is just for me, and you should change the filename and recompile it.
Code:
#include <cstdio> #include <cstdlib> #include <string.h> #define BUFFER_SIZE 4096 char buffer[BUFFER_SIZE]; char token[BUFFER_SIZE + 1]; int lookAhead; int bufferPos; int bufferLen; int nextChar(FILE *file){ if (bufferPos == bufferLen){ bufferLen = fread(buffer, 1, BUFFER_SIZE, file); if (bufferLen <= 0) return -1; bufferPos = 0; } return buffer[bufferPos++]; } void readUntil(FILE *file, char *buf, int &nowAt, char targetCh){ bool inStr = false; lookAhead = nextChar(file); while ((lookAhead != targetCh) || inStr){ buf[nowAt++] = lookAhead; if (lookAhead == '"') inStr = !inStr; lookAhead = nextChar(file); if (lookAhead < 0) return; } } void nextToken(FILE *file){ int nowAt = 0; token[nowAt++] = lookAhead; if (lookAhead == '<'){ readUntil(file, token, nowAt, '>'); token[nowAt++] = lookAhead; lookAhead = nextChar(file); } else readUntil(file, token, nowAt, '<'); token[nowAt] = '\0'; } bool beginWith(char *str, char *head){ int len = strlen(head); if (strlen(str) < len) return false; for (int i = 0; i < len; i++) if (str[i] != head[i]) return false; return true; } bool endWith(char *str, char *tail){ int len = strlen(tail); int slen = strlen(str); if (slen < len) return false; for (int i = 0; i < len; i++) if (str[slen - i - 1] != tail[len - i - 1]) return false; return true; } void printLogbankHead(char *head, FILE *file){ int i = 0; while (head[i] != ' '){ fprintf(file, "%c", head[i]); i++; } fprintf(file, " count=\"0\" "); do{ i++; } while (head[i] != ' '); i++; while ((head[i] != '/') && (head[i] != '>')){ fprintf(file, "%c", head[i]); i++; } fprintf(file, "/>"); } int main(){ FILE *xmlFile = fopen("E:/Coder.xml", "r"); FILE *outputFile = fopen("E:/Coder.output.xml", "w"); bufferPos = 0; bufferLen = 0; lookAhead = nextChar(xmlFile); while (lookAhead >= 0){ nextToken(xmlFile); if (beginWith(token, "<logbank ")){ printLogbankHead(token, outputFile); if (!endWith(token, "/>")) do{ nextToken(xmlFile); }while(strcmp(token, "</logbank>")); } else fprintf(outputFile, "%s", token); } fclose(xmlFile); fclose(outputFile); }
PS: You will also need a gun zip tool to zip and unzip the save files.


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Sun May 02, 2010 2:48 pm 
 

Joined:Thu Nov 15, 2007 2:00 pm
Posts:68
Website:http://www.skyblownet.com
Good job.
Just one thingy, you didn't had to write your own string 'searching/manipulating' methods.
If you'd just search for a(n) XML parse, you would have solved about 90% of the 'problem'.

skyblownet.


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Wed May 05, 2010 5:05 am 
 

Joined:Mon Apr 23, 2007 1:16 pm
Posts:190
i guess this will fuck up some missions, however if it doesn't fuck up storyline missions.. (devs reply?)

also i guess you could do like
Code:
int main(int argc, char* argv[]){ if (argc != 3) { printf("\nusage:\n");printf(argv[0]);printf("\"input file\" \"output file\""); return 1; } FILE *xmlFile = fopen(argv[1], "r"); FILE *outputFile = fopen(argv[2], "w");
or something..

//haven't spell checked


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Thu May 06, 2010 1:51 am 
Literally Nine
User avatar
 

Joined:Sat Apr 02, 2005 3:31 pm
Posts:1171
Location:The vicinity of an area adjacent to a location.
Yeah, this code would screw up all sorts of missions.

_________________
- Tycho

Image


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Thu May 06, 2010 11:37 am 
User avatar
 

Joined:Tue Mar 02, 2010 4:55 pm
Posts:265
AOL:superactor001
Location:Everywhere and nowhere... But also right behind you and watching you in your sleep >.>
a note on the first file. i compiled it and ran it, and it had an error. my guess is that u need to have the file in a certain location. can this be verified?

_________________
access procedure in progress...
...
/root access granted
attempting to input customized user information
upload failure, connection loss
system console session terminated


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Tue May 11, 2010 12:23 pm 
User avatar
 

Joined:Tue Mar 02, 2010 4:55 pm
Posts:265
AOL:superactor001
Location:Everywhere and nowhere... But also right behind you and watching you in your sleep >.>
and the second cant be compiled. check the printf command.

_________________
access procedure in progress...
...
/root access granted
attempting to input customized user information
upload failure, connection loss
system console session terminated


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Tue May 11, 2010 12:24 pm 
User avatar
 

Joined:Tue Mar 02, 2010 4:55 pm
Posts:265
AOL:superactor001
Location:Everywhere and nowhere... But also right behind you and watching you in your sleep >.>
of course, it might be that i only tried c and c++.

_________________
access procedure in progress...
...
/root access granted
attempting to input customized user information
upload failure, connection loss
system console session terminated


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Thu May 13, 2010 9:30 am 
 

Joined:Mon Apr 23, 2007 1:16 pm
Posts:190
Quote:
a note on the first file. i compiled it and ran it, and it had an error. my guess is that u need to have the file in a certain location. can this be verified?
Code:
FILE *xmlFile = fopen("E:/Coder.xml", "r"); FILE *outputFile = fopen("E:/Coder.output.xml", "w");
verified. need to be in "E:\Coder.xml"
thats what i tried to fix with my first post

Quote:
and the second cant be compiled. check the printf command.
it compiles for me.. what errors do you get?


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Thu May 13, 2010 12:32 pm 
User avatar
 

Joined:Tue Mar 02, 2010 4:55 pm
Posts:265
AOL:superactor001
Location:Everywhere and nowhere... But also right behind you and watching you in your sleep >.>
the whole line is red, and it says that a variable is undefined? i dont have my flash drive with the compiler on it, so i cant check right now. i'll test it asap.

_________________
access procedure in progress...
...
/root access granted
attempting to input customized user information
upload failure, connection loss
system console session terminated


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Fri May 14, 2010 1:15 am 
 

Joined:Mon Feb 16, 2009 12:42 am
Posts:11
Quote:
The code below is just for me, and you should change the filename and recompile it.
Please read the words above the code first.

There are two files, one is the profile save file, another is the output file, which is a new save file without any logs. The save file is saved at %HOME%/AppData/Romans/Onlink/%UserName%/%UserName%.tar.gz.

You should first unzip it to certain location, and change the file location in the
Code:
FILE *xmlFile = fopen("E:/Coder.xml", "r");
to the location you just unzipped.
Then set your output file location in
Code:
FILE *outputFile = fopen("E:/Coder.output.xml", "w");
to your destination output location.

For example: If you unzip the save file to "C:/abc/aaa.xml" and you want the new save file without logs to "D:/cba/aaa.xml", then the code will be
Code:
FILE *xmlFile = fopen("C:/abc/aaa.xml", "r"); FILE *outputFile = fopen("D:/cba/aaa.xml", "w");
Remember, you need to recompile the code, and you need to zip the new save file to replace the gzip file in the save directory.


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Fri May 14, 2010 12:25 pm 
User avatar
 

Joined:Tue Mar 02, 2010 4:55 pm
Posts:265
AOL:superactor001
Location:Everywhere and nowhere... But also right behind you and watching you in your sleep >.>
k. thx.

_________________
access procedure in progress...
...
/root access granted
attempting to input customized user information
upload failure, connection loss
system console session terminated


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Wed May 19, 2010 12:05 pm 
User avatar
 

Joined:Tue Mar 02, 2010 4:55 pm
Posts:265
AOL:superactor001
Location:Everywhere and nowhere... But also right behind you and watching you in your sleep >.>
heres a printscreen :
of the compiling error


Attachments:
compilererror.doc [120.5KiB]
Downloaded 669 times

_________________
access procedure in progress...
...
/root access granted
attempting to input customized user information
upload failure, connection loss
system console session terminated
Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Thu May 20, 2010 1:37 am 
Literally Nine
User avatar
 

Joined:Tue Mar 01, 2005 9:00 am
Posts:1263
A printscreen? Placed in a .doc?

What's wrong with you?


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Thu May 20, 2010 11:11 am 
User avatar
 

Joined:Tue Mar 02, 2010 4:55 pm
Posts:265
AOL:superactor001
Location:Everywhere and nowhere... But also right behind you and watching you in your sleep >.>
i cant find the system clipboard folder to be able to cut it from there and put it on the site.

_________________
access procedure in progress...
...
/root access granted
attempting to input customized user information
upload failure, connection loss
system console session terminated


Top
Offline  
 Post subject:Re: OnlinkLogNuker
PostPosted:Thu May 20, 2010 12:26 pm 
User avatar
 

Joined:Sat Jun 03, 2006 3:51 am
Posts:1186
Website:http://griffinhart.livejournal.com/
Yahoo Messenger:Squall591
AOL:FinalWarrior591
Location:Look at my horse, my horse is amazing!
Print Screen.

Open Paint (or any other image editing program).

Control-V.

Save as .jpg, .png, or any other reasonable image format.

Upload in a post (which you are already capable of, it seems).

I fail to understand how you could manage to printscreen into a .doc but not into a .jpg or a .png. The process for either is identical except for the program you open up to paste into.

-- Griffinhart

_________________
"My word is my honor. My honor is my life."
-- Demonchild, Angelkin, the Blackest Seraph, the Final Warrior

Image


Top
Offline  
Display posts from previous: Sort by 
Post new topic Reply to topic

All times are UTC-05:00


Who is online

Users browsing this forum: No registered users and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created by Miah with assistance from hyprnova