Kyme Posted June 28, 2008 Share Posted June 28, 2008 (edited) i can make it like this pass() Func pass() Local $iTries = 4, $passwd $random=String(Random(1, 6, 1)) $pass=IniRead(@ScriptDir & "\data.dll", "Word", "1", "") $Ques=iniRead(@ScriptDir & "\data.dll", "Question","1", "") While 1 $passwd = InputBox("Password", IniRead(@ScriptDir & "\data.dll", "Question", $random, ""), "", "*") If $passwd = IniRead(@ScriptDir & "\data.dll", "Word", $random, "") then MsgBox(64, "Correct", "Corect") ExitLoop Else $iTries -= 1 If $iTries Then MsgBox(16, "Warning", "Wrong! You have " & $iTries & " attempts left.") Else MsgBox(16, "Warning", "You have Wrong the Password 3 times") Exit EndIf EndIf WEnd EndFuncbut i wanna make it to iniread but file to be from webthe link to be http://kyme32.webs.com/data.txt it's same like data.dll but how to make it???i want to modify my bot to be whit username and password...to have acces only who i want^^can give me somebody some example???this is only test script to be sure that it works Edited June 28, 2008 by Kyme Link to comment Share on other sites More sharing options...
Kip Posted June 28, 2008 Share Posted June 28, 2008 INetGet() or _INetGetSource() MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Kyme Posted June 28, 2008 Author Share Posted June 28, 2008 INetGet() or _INetGetSource()ok but it's posible to don't download the file on pc???i want to be sure somebody don't hack my accounts....it's simple to open whit notepad some file and see the accounts...but when it's form one link they don't know iti can make it like when start the bot to copy the file and when it's log in to delete it but if it's not log in true then file exist and can find easy the account^^ Link to comment Share on other sites More sharing options...
Kip Posted June 28, 2008 Share Posted June 28, 2008 _INetGetSource() doesn't save anything. It just returns the content of a file. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Kyme Posted June 28, 2008 Author Share Posted June 28, 2008 _INetGetSource() doesn't save anything. It just returns the content of a file. aha now i saw the example... but i have one problem....i have some wrong on my script... #include <INet.au3> pass() Func pass() Local $iTries = 4, $passwd $site= _INetGetSource("http://kyme32.webs.com/data.txt") $random=String(Random(1, 6, 1)) $pass=IniRead($site, "Word", "1", "") $Ques=iniRead($site, "Question","1", "") While 1 $passwd = InputBox("Password", IniRead($site, "Question", $random, ""), "", "*") If $passwd = IniRead($site, "Word", $random, "") then MsgBox(64, "Correct", "Corect") ExitLoop Else $iTries -= 1 If $iTries Then MsgBox(16, "Warning", "Wrong! You have " & $iTries & " attempts left.") Else MsgBox(16, "Warning", "You have Wrong the Password 3 times") Exit EndIf EndIf WEnd EndFunc you can tell me please what i wrong??? Link to comment Share on other sites More sharing options...
Kip Posted June 28, 2008 Share Posted June 28, 2008 IniRead($site, "Word", "1", "")IniRead reads a file, not a string. You have to save it to a file, and after you read it, delete it. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Kyme Posted June 28, 2008 Author Share Posted June 28, 2008 IniRead reads a file, not a string. You have to save it to a file, and after you read it, delete it.you can give me some example how i can read one section like from .ini file but to don't save the file in hdd?tnx Link to comment Share on other sites More sharing options...
Kip Posted June 28, 2008 Share Posted June 28, 2008 you can't, or you have to save it, or you have to create your own IniRead function. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
Kyme Posted June 28, 2008 Author Share Posted June 28, 2008 you can't, or you have to save it, or you have to create your own IniRead function. ok but i think it's posible to read from one http first line or some line from it.... example in the http://kyme32.webs.com/data.txt first line are [Word] it's posible some way to msgbox the line??? or read line we supose the line are "line1" if readline1="line1" then MsgBox(0, "Line1", "True") else MsgBox(0, "Line1", "False") endif can be that make it in some way? Link to comment Share on other sites More sharing options...
rudi Posted June 28, 2008 Share Posted June 28, 2008 ok but it's posible to don't download the file on pc???i want to be sure somebody don't hack my accounts....it's simple to open whit notepad some file and see the accounts...... and it's simple as well to use e.g. wireshark to see the content of your User/Pass file in the http:// trafficic.Google for "wireshark" and give it a try to see how easy it is!Move the authentication from the client side to the server...Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 28, 2008 Moderators Share Posted June 28, 2008 Using _InetGetSource, you could manipulate the functions here http://www.autoitscript.com/forum/index.ph...c=32004&hl= and instead of forcing you to pass a filename to read, you could use the regular expressions there to figure out how to just pass a string to them for manipulation. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
NELyon Posted June 28, 2008 Share Posted June 28, 2008 (edited) Using _InetGetSource, you could manipulate the functions here http://www.autoitscript.com/forum/index.ph...c=32004&hl= and instead of forcing you to pass a filename to read, you could use the regular expressions there to figure out how to just pass a string to them for manipulation. Good idea expandcollapse popup#Include <INet.au3> MsgBox(0, "Test", _IniRead("http://kyme32.webs.com/data.txt", "question", "1")) Func _IniRead($sUrl, $Section, $KeyName, $Default = "") Local $INIContents, $PosSection, $PosEndSection, $sContents, $Value, $Found $INIContents = _INetGetSource($sUrl) If @error Then Return SetError(@error, @error, @error) ;Find section $PosSection = StringInStr($INIContents, "[" & $Section & "]") If $PosSection > 0 Then ;Section exists. Find end of section $PosEndSection = StringInStr(StringMid($INIContents, $PosSection + 1), "[") + ($PosSection - 2) ;?Is this last section? If $PosEndSection = 0 Then $PosEndSection = StringLen($INIContents) + 1 ;Separate section contents $sContents = StringMid($INIContents, $PosSection, $PosEndSection - $PosSection) Local $Found = False If StringInStr($sContents, $KeyName & "=") > 0 Then $Found = True ;Separate value of a key. $Value = _SeparateField($sContents, $KeyName & "=", @CRLF) EndIf EndIf If Not $Found Then $Value = $Default Return $Value EndFunc ;==>_IniRead Func _SeparateField($sFrom, $sStart, $sEnd) Local $PosB = StringInStr($sFrom, $sStart) If $PosB > 0 Then $PosB = $PosB + StringLen($sStart) Local $PosE = (StringInStr(StringMid($sFrom, $PosB), $sEnd)) If $PosE Then $PosE += $PosB If $PosE = 0 Then $PosE = StringInStr($sFrom, @CRLF) If $PosE = 0 Then $PosE = StringLen($sFrom) + 1 Return StringMid($sFrom, $PosB, $PosE - $PosB) EndIf EndFunc ;==>_SeparateField I only modified one line of code, and it works fine. Original code by Gary Edited June 28, 2008 by KentonBomb Link to comment Share on other sites More sharing options...
ResNullius Posted June 28, 2008 Share Posted June 28, 2008 you can give me some example how i can read one section like from .ini file but to don't save the file in hdd?tnxSee here: http://www.autoitscript.com/forum/index.ph...showtopic=72690 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 28, 2008 Moderators Share Posted June 28, 2008 Good idea expandcollapse popup#Include <INet.au3> MsgBox(0, "Test", _IniRead("http://kyme32.webs.com/data.txt", "question", "1")) Func _IniRead($sUrl, $Section, $KeyName, $Default = "") Local $INIContents, $PosSection, $PosEndSection, $sContents, $Value, $Found $INIContents = _INetGetSource($sUrl) If @error Then Return SetError(@error, @error, @error) ;Find section $PosSection = StringInStr($INIContents, "[" & $Section & "]") If $PosSection > 0 Then ;Section exists. Find end of section $PosEndSection = StringInStr(StringMid($INIContents, $PosSection + 1), "[") + ($PosSection - 2) ;?Is this last section? If $PosEndSection = 0 Then $PosEndSection = StringLen($INIContents) + 1 ;Separate section contents $sContents = StringMid($INIContents, $PosSection, $PosEndSection - $PosSection) Local $Found = False If StringInStr($sContents, $KeyName & "=") > 0 Then $Found = True ;Separate value of a key. $Value = _SeparateField($sContents, $KeyName & "=", @CRLF) EndIf EndIf If Not $Found Then $Value = $Default Return $Value EndFunc ;==>_IniRead Func _SeparateField($sFrom, $sStart, $sEnd) Local $PosB = StringInStr($sFrom, $sStart) If $PosB > 0 Then $PosB = $PosB + StringLen($sStart) Local $PosE = (StringInStr(StringMid($sFrom, $PosB), $sEnd)) If $PosE Then $PosE += $PosB If $PosE = 0 Then $PosE = StringInStr($sFrom, @CRLF) If $PosE = 0 Then $PosE = StringLen($sFrom) + 1 Return StringMid($sFrom, $PosB, $PosE - $PosB) EndIf EndFunc ;==>_SeparateFieldoÝ÷ Ø')¨v'âyÚ'zX§zÜ¡×ØÂä±ø§xêâ)ÚÊy¼j¼¿ªê-xÚ-ªè{Z´Zv)æwOjëh×6#include <inet.au3> Func _InetIniRead($s_url, $v_section, $v_key, $v_default = -1) If $v_default = -1 Or $v_default = Default Then $v_default = "" Local $s_text = _INetGetSource($s_url) If $s_text <> "" Then $s_text = @CRLF & $s_text & @CRLF $v_section = StringStripWS($v_section, 7) Local $a_data = StringRegExp($s_text, "(?s)(?i)\n\s*\[\s*" & $v_section & "\s*\]\s*\r\n(.*?)\[", 3) If IsArray($a_data) = 0 Then Return SetError(1, 0, 0) Local $a_read = StringRegExp(@LF & $a_data[0], "(?s)(?i)\n\s*" & $vKey & "\s*=(.*?)\r", 1) If IsArray($a_read) = 0 Then Return SetError(2, 0, 0) Return $a_read[0] EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Kyme Posted June 28, 2008 Author Share Posted June 28, 2008 Good idea holly shit.....this really work....you save my life....i have trying to make some like that for 5h ^^tnx dude....you are awesome....i will credit it to you and Gary ^^cya later...and tnx again for helpRegards, Kyme Link to comment Share on other sites More sharing options...
NELyon Posted June 28, 2008 Share Posted June 28, 2008 Func _InetIniRead($s_url, $v_section, $v_key, $v_default = -1) If $v_default = -1 Or $v_default = Default Then $v_default = "" Local $s_text = _INetGetSource($s_url) If $s_text <> "" Then $s_text = @CRLF & $s_text & @CRLF $v_section = StringStripWS($v_section, 7) Local $a_data = StringRegExp($s_text, "(?s)(?i)\n\s*\[\s*" & $v_section & "\s*\]\s*\r\n(.*?)\[", 3) If IsArray($a_data) = 0 Then Return SetError(1, 0, 0) Local $a_read = StringRegExp(@LF & $a_data[0], "(?s)(?i)\n\s*" & $vKey & "\s*=(.*?)\r", 1) If IsArray($a_read) = 0 Then Return SetError(2, 0, 0) Return $a_read[0] EndFuncI used what I had on hand I've tried learning regular expressions like... well... alot of times. Never really stuck on me. Eh, either one of them still works Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 28, 2008 Moderators Share Posted June 28, 2008 (edited) #include <inet.au3> $s_string = _InetIniRead("http://kyme32.webs.com/data.txt", "Question", 2) ConsoleWrite($s_string & @CRLF) Func _InetIniRead($s_url, $v_section, $v_key, $v_default = -1) If $v_default = -1 Or $v_default = Default Then $v_default = "" Local $s_text = _INetGetSource($s_url) If $s_text = "" Then Return SetError(1, 0, $v_default) $s_text = @CRLF & $s_text & @CRLF $v_section = StringStripWS($v_section, 7) Local $a_data = StringRegExp($s_text, "(?s)(?i)\n\s*\[\s*" & $v_section & "\s*\]\s*\r\n(.*?)(?m:\[|\z)", 3) If IsArray($a_data) = 0 Then Return SetError(2, 0, $v_default) Local $a_read = StringRegExp(@LF & $a_data[0], "(?s)(?i)\n\s*" & $v_key & "\s*=(.*?)\r", 1) If IsArray($a_read) = 0 Then Return SetError(3, 0, $v_default) Return $a_read[0] EndFunc Edit: There was an error with mine (Never tested it)... should work now. Edit2: Had to change SetError values from 0 to blank ... it shouldn't return anything if there is an error Edited September 24, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now