Jump to content

OneTimePad

Active Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by OneTimePad

  1. The hack was by ZF0: REDACTED plaintext passwords begin at about 75% down the page.
  2. $var = `sh hello.sh>/dev/null && echo "Complete"`; Will hide any standard output from hello.sh. $var = `sh hello.sh>/dev/null 2>&1 && echo "Complete"`; will hide standard output and error output from hello.sh
  3. The problem with an eval() in C is that C is a compiled language, so by the time the user enters the string to evaluate, function names and other higher level language features have been reduced to machine code. This is why C doesn't have a built-in eval function, but an interpreted language like javascript does: in js, when eval() is called, it is translated into machine code on-the-fly, so interpreting the string you want to evaluate is just a matter of sending it to the interpreter. So, there are two ways to do an eval-like function in C that I can think of: 1) If you only need a limited number of commands, you could build a small interpreter that would parse the supplied string and execute the appropriate function calls, etc. Theoretically, you could write something universal, but then you'd have a full C interpreter, and I doubt you want to embark on a project that ambitious... 2) You could: i) wrap the input string in a "main(){...}", ii) write this to a file (with appropriate #includes, etc), iii) compile the file with gcc, iv) execute the generated binary as a child process, and v) after execution, return control to the main program and delete the files from ii) and iii)... Solution 1) would give you access to only as many features as you code for, but it would give you access to other parts of your program. Solution 2) would allow you to enter any C code, but you wouldn't be able to access other parts of your program directly. Edit: Info on how GDB gets it's symbolic information (e.g. function and variable names, etc) here: http://sourceware.org/gdb/current/onlinedo...nt_8.html#SEC49
  4. K, a few answers/tips: 1) Perl can be used on its own. When you load a php file, the server runs the php script and sends you the output. Likewise, you can configure your server to run perl scripts the same way. Go here for more information. You should also use the perl CGI module. (To install, from command-line: 'perl -MCPAN -e "shell"', then, from prompt: 'install CGI' If CPAN has never been used on your server before, you will be lead through a set-up before you get to that prompt.) 2) If your 'applications' are in .html files, the <script src='...'> tags won't work, because the src property expects a javascript file. You can fix this one of two ways: a) instead of printing the <script> tags, just echo the entire file: foreach $app (@apps) { open(CURAPP, '&lt;$app'); while($appline = &lt;CURAPP&gt;) { print $appline; } #... print "&lt;a ondblClick='$app(); return false'&gt;"; } b ) in your initial post, it looks like your application files just consist of <script> tags w/the script inside them. If this is the case, you can remove the script tags and rename the files .js. then the original script should work. also, that first line of my example is ridiculously ugly... idk what i was thinking... here's a much better version: my @apps = split /, /, `ls -m Applications/*.html`; #or *.js if you change them 3) If you're more familiar with PHP than perl, you can use it for the server-side scripting aspect of your OS. I wrote it in perl because it's been a while since i used PHP. Here's a PHP version (No guarantees that it will work) &lt;?php $apps = explode(", ", `ls -m Applications/*.html`); foreach ($apps as $app) { //.html version $file = fopen($app,"r"); while(!feof($file)) { echo fgets($file); } //.js version /* echo "&lt;script src='Applications/".$app."' /index.html&gt;"; */ echo "&lt;a ondblClick='".$app."(); return false'&gt;"; } ?&gt;
  5. 1) To dynamically load applications requires some form of server side scripting. Simple (partial, untested) example in perl: #get the list of applications my @apps = `ls -l Applications/ | sed -n /^-/s/\ \ */\ /gp | cut -d" " -f 9`; foreach $app (@apps) { print "&lt;script src='Applications/$app' /&gt;"; #... print "&lt;a ondblClick='$app(); return false'&gt; &lt;p&gt;&lt;img src='Applications/$app/$app.png' border='0' style='float:left' class='dragableElement'&gt;"; } (note, this assumes that the contents of the Application folder are .js files, and somewhere in the '...' $app should be stripped of the '.js', also, there's probably a better way to get the list of .js files than the ugly first line...) 2) To control what is on top, there is the css property z-index. The higher the z-index of an element, the higher it is off the screen (e.g. highest z-index is on top).
  6. How it works: if you have two integers, x and y, x^y will return an integer such that each bit will be 0 if the corresponding bits from x and y are the same, and 1 if they are different. This leads to two properties: z = x^x == 0, because every bit is the same, and z = x^0 == x, because when nth bit of x is 1, it is different from 0, therefor the nth bit of z is 1, and when the nth bit of x is 0, it is the same as 0, therefor the nth bit of z is 0. Ex: 5^4 = 0b101^0b100 = 0b001 = 1 <-- only the last bit is different 7^9 = 0b0111^0b1001 = 0b1110 = 14 <-- the first three bits are different 7^0 = 0b111^0b000 = 0b111 = 7 <--only the bits that are 1 (all three) are different 8^0 = 0b1000^0b0000 = 0b1000 = 8 <-- only the bits that are 1 (the first) are different 6^6 = 0b110^0b110 = 0b000 = 0 <-- no bits are different So, if you traverse an array, and xor each item with the cumulative xor of the previous, any duplicates will cancel out: int nums[5] = {1,1,2,2,3}; int i, x = 0; for(i = 0; i &lt; 5; i++) x = x^nums[i]; cout &lt;&lt; x &lt;&lt; endl; results in: x = 1^1^2^2^3 = (1^1)^(2^2)^3 = 0^0^3 = 0^3 = 3 Note: this will work so long as 1) there is only ONE unique number (otherwise, it will return the xor of all unique elements), and 2) any duplicate elements have an even number of elements (they cancel out in pairs, and any remaining numbers would 'pollute' the output)
×
×
  • Create New...