Jump to content

soadlink

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Everything posted by soadlink

  1. Tried that and it connects 1 time, and the rest of the time I get the error: PHP Notice: fwrite(): send of 199 bytes failed with errno=10053 An established connection was aborted by the software in your host machine. in C:\2.php on line 39 The server closes the socket, so I have to re-open it in the loop, or I can't keep writing to the same socket. Also btherl, I didn't see those errors in my logs but I tried the tool anyway and upped the max connections to 40000 and restarted. After rebooting, it still times out the same as before.... and still only lets me have 1 at a time. Any other ideas?
  2. Thanks, sorry was posting when you wrote that. I'll give it a look
  3. Ok it seems I can only keep 1 socket going with my script. Even having 2 instances going causes it to freeze. Maybe it has to do with my code: <?php $count = 0; $filepath = 'list.txt'; $lines = array_map('rtrim',file($filepath)); foreach ($lines as $line) { $count = $count + 1; $word = $line; $socket = fsockopen('server.com', 12345, $err, $str, 10); $first = ''.fread($socket, 512); fwrite($socket, $word); $done = ''.fread($socket, 512); echo $done . " (" . $count . ")" . "\n"; } ?> Anyone? It works fine with 1 instance, but multiple instances causes it to just stop shortly after it starts
  4. I work with sockets a lot on various languages, such as PHP and VB. I've always been looking for a way to have a bunch of sockets connecting and disconnecting to certain servers because some things I work with require this, but whenever I have too many sockets connecting and disconnecting it always gets very laggy and starts to time out, and even stop all together. This happens with php and VB both. However when I upload this certain php script that is causes me lag on my home pc to my webserver (that is professionally hosted), and have it running in multiple instances there, it never seems to have problems. But when I have too many instances of it running on my machine at home, I can only have a few instances going or it will timeout and give errors. Is this just my machine? It's a decent machine (2.8GHz AMD, 2GB ram). Or my internet connection? (8000/384). Or something in my OS (windows xp pro) limiting the amount of open sockets? The script I use opens/closes about 2-3 sockets a second to the server I am working with. And I can have about 4-5 instances running before it starts to get laggy and timeout. But on my webhost, where the script has also ran before, can handle multiple instances just fine, so its nothing on the server's end that I'm working with. Any ideas? ???
  5. Nevermind, got it with a little more searching $lines = array_map('rtrim',file('file.txt')); foreach ($lines as $line) { echo $line; } I use the first line because it removes a blank line that the code $lines = file('c:\\list.txt'); adds to the end :-\, in case anyone wonders. Only way I knew how to remove that blank line.
  6. Hello, I'm looking for a way to read large lists word by word (will be done locally through command line) that are in a txt file. The lists will be anywhere from 2000 - 100000 words (but it should be able to handle any amount). Then something will be done with each word (specified by me), and then it will move on to the next word in the list. The list would be 1 word per line, like: word1 word2 word3 So it would be some kind of loop until the script is done going through the list. Also, it should not alter the list at all, such as removing the words or re-arranging them. I will change what happens with each word, but if you provide an example you can just echo the word and start a new line "\n". Thanks
  7. Hello, I'm looking for a simple method to base64 encode any string, but with a custom character set as defined by me. For example if you look here about 1/8 of the way down (http://www.developer.com/java/other/article.php/3386271), you have the final characters based on the value, with your padding character being the = I would like to be able to customize the final output characters, including the padding character. Hopefully there is an easy way to do this without having to re-write the entire base64 process, but if that's what has to be done I'll accept that. Any ideas? Thanks
  8. [quote author=Daniel0 link=topic=123055.msg508159#msg508159 date=1169159360] It may be some custom algorithm. If you got it in your code, post it here so we can see it. [/quote] I'm actually packet scanning while creating an account through a program (which is a .exe file), and the program does the encoding itself and sends the encoded version to a server. I pick up the encoded version of my password I chose through a packet scan. I didn't make the program (doing the encoding) so I dont have the source code :( The encoding is the password of the account you are creating, so I know the before and after, I'd just like to know how its done without having to create an account/packet scan everytime. thanks  8)
  9. Any of you know a way to tell what type of encoding was used with the following entries: 123 = [b]J8DH[/b] 1234 = [b]J8DHxg__[/b] 12345 = [b]J8DHxh4_[/b] 123abc [b]J8DHk0m4[/b] abc = [b]d5CX[/b] abcd =[b] d5CXlg__[/b] abcde = [b]d5CXlk4_[/b] abc123 [b]d5CXwxno[/b] It looks like some kind of standard (like base64) but I can't tell, so I was hoping someone here might be able to figure it out. I need to this cause I am working on reversing a certain application, and this is how their passwords are encoded and sent to and from a certain server  :-\ I can give you any other words and their encoded version if you need more samples....it just takes me a few mins cause I have to do some packet scanning while creating a new account with this certain application. Anyways, thanks a bunch  8)
  10. Wahoo! That works great  8) Thank you very much!  ;D :D
  11. I tried your code but it didn't work. I used a few different test strings such as:  abc123, abc, 123... all turn out to say it doesn't contain only hex, when it does. But I did try just a single "1" and it said it was all hex, which is true. ???
  12. This is probably very easy, I just cant think of a SIMPLE way to do it: I'm looking for a php function that will search a string and output whether or not the string contains all hexadecimal characters or not. So here is a sample: [code=php:0]$string = 'abcdef1234567890z'; // function to check it echo 'Your string does NOT contain only hexadecimal characters';[/code] or if the string was 'abcdef1234567890', [code=php:0]echo 'Your string contains all hexadecimal characters.';[/code] Also on a side note, I need a simple way (javascript code maybe) to disable a "Submit" button in an html form until a certain number of characters have been entered into a text box that is located in that same form. Any help there would be good too (will most like need some javascript). Thanks  8)
  13. I got it to work just fine except I had to switch 1 thing in your code: [code]$query = "SELECT COUNT(*) AS total FROM md5 WHERE md5='" . $md5 . "'";[/code] I set it to search for the md5 of the string that is being added instead of the original string. If I set it to search for the original string (if it has all spaces), the php code still doesn't find it on its own and wants to add it, then mysql denies the request any gives that error... so I set it to search for the md5 of the string instead and now the php code catches the duplicate. I guess the only problem that could occur with this is if for md5 collisions... where 2 different strings have the same md5. But I don't think the database will grow big enough for that. Thanks for the reply  8), any other ideas with this project? edit: Added the pre and /pre tags to the strings that are echoed. That way when it displays a string like "Hello        There"  it shows up correctly on the page... and not "Hello There". :D
  14. Actually, right on this site there nice tutorial on sockets: http://www.phpfreaks.com/tutorials/50/0.php
  15. Hello, I am working on a simple project where users can add strings of text to a mysql database that are converted to MD5, and search for MD5's that may already be in the database and reverse them to their string. So far, everything seems to work out ok, except when I add strings that are just spaces. For example, I will use my add.php script to add the string "          " which is just 10 spaces. I get my confirmation I set up that says it was added ok. Then I go back and add the SAME string (10 spaces), and my script is SUPPOSED to say "That string is already in the database" like it does with normal strings, and not add the string... but instead a mysql error occurs. I modified my code to display the mysql error, and it is: [b]Duplicate entry '41b394758330c83757856aa482c79977' for key 1[/b]. This seems simple, it doesnt want a duplicate entry, except my code should already check for that! Here is my code for adding strings: [quote][code=php:0]<?php //Get string to add, and convert it to md5 $premd5 = $_POST['premd5']; $md5 = md5($premd5); //database info $location = "localhost"; $username = "username"; $password = "password"; $database = "database"; //connect to the database and display any connection errors $conn = mysql_connect("$location","$username","$password"); if (!$conn) die ("Could not connect to database."); mysql_select_db($database,$conn) or die ("Could not open database."); //query the database to find any existing entries for that string $query = "SELECT * FROM md5 WHERE orig='$premd5'"; $result = mysql_query($query); $row = mysql_fetch_array($result); //if the string is already there, tell the user, and do not add it again if ($row[orig] == $premd5){     echo 'The string <b>' . $premd5 . '</b> is already in the database:<br/><br/>';     echo $row[md5]; } else { //if the string is not there, attempt to add it with its md5 and display confirmation $insert = "INSERT INTO md5 (orig,md5)     VALUES ('$premd5','$md5')";     mysql_query($insert) or die ('Error adding data: ' . mysql_error()); echo 'Added the string <b>' . $premd5 . '</b> with the hash <b>' . $md5 . '</b> to the database.'; } ?>[/code][/quote] It appears that my php code doesn't find the existing string by itself... and attempts to add it to the database... but mysql stops it saying it's already there (which it is). On a side note, as far as I know every other string works fine and I am only having problems adding strings that are just spaces. So even the string "Hello        There" works fine with my script. Some info about the table from phpmyadmin: [img]http://img278.imageshack.us/img278/2444/tableyn8.jpg[/img] I can provide any other info if needed.. and I know there are probably other things that could change to improve this project so off topic comments are fine too  8) Thanks!
  16. [quote author=btherl link=topic=119351.msg488736#msg488736 date=1166604380] Oh.. about the undefined constant, did you try [code=php:0]md5(string);[/code] or did you try [code=php:0]md5('string');[/code]?  Usually that warning is given if you don't quote a string literal. [/quote] I used: <?php $str = "÷¨ª®±‰"; echo md5($str); ?> Edit: Apparently before I didn't use the quotes, so you are correct btherl, now it gives no 'notices', and still the same output. Sorry for that
  17. Thanks for the reply! I did change the 'character set' in character map when I chose that string above. It was a mix between unicode and Windows: Western. It appears if I use an all unicode string such as æèçØ×½»ºâ³´¯, all sites give the same output. I guess I could just find a way to just block all md5 conversions that aren't using 'unicode' characters  :-\
  18. I am just curious about the MD5() function. I have converted the complex string [b]÷¨ª®±‰[/b] using the function, and have gotten the result: 4fd39908710727a1038acf8146802710 But when I went to test this string on other sites that convert strings to MD5 (using different methods like javascript) they give different outputs. So I am just curious as to what the CORRECT md5 hash for that string is, and if php is even giving the correct hash... or if the other sites are wrong. Here are some of the outputs other sites have given me: 8252934fd1fca2fda8feaa8e20f9b700 (http://www.cs.eku.edu/faculty/styer/460/Encrypt/JS-MD5.html) and e9d9e770c1b72425494f799478ffeba4 (http://b-con.us/pages/md5.php). I also went to a php console to see what was happening, and php gives a 'Notice:' when I hash the string: http://img227.imageshack.us/img227/4882/md5xk0.jpg I just want to be sure the hashes are being calculated correctly. I am working with a little project that adds md5 hashes and/or searches for them in a mysql database, and don't want bad data  8) Thanks!
  19. Hello I need some help with code where I could store a string as $string and then XOR it 1 character at a time by the phrase "gamespy". So if I have HelloWorld for my string, I want to XOR the H, then the e, then the l.... and so on until the string is done. Then I want to echo the XOR conversions together. I am bascially trying to port the C code blow over to PHP, or even over to VB would be nice (just a way that will help me understand it) but here is the original C code[code]void gamespyxor(u_char *data, int len) {     u_char  gamespy[] = "gamespy",             *gs;     for(gs = gamespy; len; len--, gs++, data++) {         if(!*gs) gs = gamespy;         *data ^= *gs;     } }[/code]
  20. Wintergreen, Thank you very much. I actually figured it out with explode. For every \, I actually needed to specify it as 2 backslashes \\. My code ended up being: [code] $array = explode("\\", $third); echo $array[10];[/code] $third being the string I was exploding. "\\" was to explode it at every \ in that string. And the 10 is because the 10th instance of a "\" in my string is where the email is. Thanks again for the helping!
  21. Thanks for replying anyway 8). I was tinkering around with it before your post edit and couldnt get it to work myself.
  22. Hello, Before I ask this quick question, I'll just mention that i did search google and the forums, but did not find exactly what i was looking for, so here goes: I am looking for a method to parse an email address out of a string of data. Since email addresses can be various legnths, I dont think using something like substr() will work. Is there a method to pull out a string of data using 'before' and 'after' strings? For example a string can look like this: [i][b]5345345534883\email\test@email.com\sig\[/b][/i] So I'm looking for something that could use '\email\' as a before, and \sig\ as an after, and pull out whatever is in the middle of that. In this case, it would be the email. Im sure there is a particular function to do that, I just dont know what it is  ??? Thanks for the help!
  23. Thanks for the help! I have played with this tutorial, and I know I coded my test page correctly, but when I load it the page just sits there. Is this because the php sockets module wasnt compiled as you said it must be? Here is my code: [code]<? $socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); $connection = socket_connect($socket,'gpcm.gamespy.com',29900); while($data = socket_read($socket,2046,PHP_NORMAL_READ)) //listen for any data, and echo that data out { echo $data; } ?>[/code] After connecting, that server (gpcm.gamespy.com:29900) should automatically send back a reply without the client sending anything. But I get nothing, just a page that appears to be loading forever.
  24. Hello, I was wondering (since PHP is very powerful) if it was possible to connect to a certain IP and port of a server that accepts connections on that port, send strings of data, and receive data that the server sends. <-- all of course with php. So I am basically looking to see if there is a Winsock 6.0 (a visual basic control) equivelent with PHP code. Hope that explains it, thanks!  ;D
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.