It's unfortunate that when we feel a storm, we can roll ourselves over 'cause we're uncomfortable, oh well the devil makes us sin, but we like it when we're spinning, in his grin...

Δευτέρα 19 Δεκεμβρίου 2011

webRequests VB.NET

What is a web request?A web request is an http connection from your computer to another website or file online.

Example. Lets say we have this page:

http://www.example.com/c.php?count=1

Where count represents a simple counter, you can alter the values either by accesing the page and using the GUI, or by entering a link like this "http://www.example.com/c.php?count=2", this should make the counter proceed to 2.

So how can we do this with a WebRequest?

Its just as simple as this one line of code:

  Dim Response As Net.HttpWebResponse = Net.WebRequest.Create("http://www.example.com/c.php?count=2").GetResponse  

The webRequest code is after the "=".So what we did here was that we accesed a certain page, changed a few values and waited for the response just to be sure it worked.
I recommend you to always wait for the response, because most of the times if you don't it doesn't work properly.

Like so if we want we can change the page's counter to whatever.Lets say we have like a textbox named txtNum.We could do something like this:
 Private Sub txtNum_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtNum.TextChanged  
     Dim Response As Net.HttpWebResponse = Net.WebRequest.Create("http://www.example.com/c.php?count=" & CInt(txtNum.Text)).GetResponse  
   End Sub

This is a fairly easy job.I will post more advanced stuff later on.

keyboard hooking VB.NET

 Imports System.Runtime.InteropServices  
 Public Class KeyboardHook  
   <DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _  
   Private Overloads Shared Function SetWindowsHookEx(ByVal idHook As Integer, ByVal HookProc As KBDLLHookProc, ByVal hInstance As IntPtr, ByVal wParam As Integer) As Integer  
   End Function  
   <DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _  
   Private Overloads Shared Function CallNextHookEx(ByVal idHook As Integer, ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer  
   End Function  
   <DllImport("User32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _  
   Private Overloads Shared Function UnhookWindowsHookEx(ByVal idHook As Integer) As Boolean  
   End Function  
   <StructLayout(LayoutKind.Sequential)> _  
   Private Structure KBDLLHOOKSTRUCT  
     Public vkCode As UInt32  
     Public scanCode As UInt32  
     Public flags As KBDLLHOOKSTRUCTFlags  
     Public time As UInt32  
     Public dwExtraInfo As UIntPtr  
   End Structure  
   <Flags()> _  
   Private Enum KBDLLHOOKSTRUCTFlags As UInt32  
     LLKHF_EXTENDED = &H1  
     LLKHF_INJECTED = &H10  
     LLKHF_ALTDOWN = &H20  
     LLKHF_UP = &H80  
   End Enum  
   Public Shared Event KeyDown(ByVal Key As Keys)  
   Public Shared Event KeyUp(ByVal Key As Keys)  
   Private Const WH_KEYBOARD_LL As Integer = 13  
   Private Const HC_ACTION As Integer = 0  
   Private Const WM_KEYDOWN = &H100  
   Private Const WM_KEYUP = &H101  
   Private Const WM_SYSKEYDOWN = &H104  
   Private Const WM_SYSKEYUP = &H105  
   Private Delegate Function KBDLLHookProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer  
   Private KBDLLHookProcDelegate As KBDLLHookProc = New KBDLLHookProc(AddressOf KeyboardProc)  
   Private HHookID As IntPtr = IntPtr.Zero  
   Private Function KeyboardProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Integer  
     If (nCode = HC_ACTION) Then  
       Dim struct As KBDLLHOOKSTRUCT  
       Select Case wParam  
         Case WM_KEYDOWN, WM_SYSKEYDOWN  
           RaiseEvent KeyDown(CType(CType(Marshal.PtrToStructure(lParam, struct.GetType()), KBDLLHOOKSTRUCT).vkCode, Keys))  
         Case WM_KEYUP, WM_SYSKEYUP  
           RaiseEvent KeyUp(CType(CType(Marshal.PtrToStructure(lParam, struct.GetType()), KBDLLHOOKSTRUCT).vkCode, Keys))  
       End Select  
     End If  
     Return CallNextHookEx(IntPtr.Zero, nCode, wParam, lParam)  
   End Function  
   Public Sub New()  
     HHookID = SetWindowsHookEx(WH_KEYBOARD_LL, KBDLLHookProcDelegate, System.Runtime.InteropServices.Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly.GetModules()(0)).ToInt32, 0)  
     If HHookID = IntPtr.Zero Then  
       Throw New Exception("Could not set keyboard hook")  
     End If  
   End Sub  
   Protected Overrides Sub Finalize()  
     If Not HHookID = IntPtr.Zero Then  
       UnhookWindowsHookEx(HHookID)  
     End If  
     MyBase.Finalize()  
   End Sub  
 End Class  

Create the hook:
 Private WithEvents kbHook As New KeyboardHook  

And use it like this:

 Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles kbHook.KeyDown Debug.WriteLine(Key.ToString) End Sub Private Sub kbHook_KeyUp(ByVal Key As System.Windows.Forms.Keys) Handles kbHook.KeyUp   
 Debug.WriteLine(Key)  
 End Sub  

Thanks to sim0n.

Πέμπτη 15 Δεκεμβρίου 2011

get browser saved passwords

PasswordFox

PasswordFox is a small password recovery tool for Windows that allows you to view the user names and passwords stored by Mozilla Firefox Web browser. By default, PasswordFox displays the passwords stored in your current profile, but you can easily select to watch the passwords of any other Firefox profile. For each password entry, the following information is displayed: Record Index, Web Site, User Name, Password, User Name Field, Password Field, and the Signons filename.

ChromePass
ChromePass is a small password recovery tool for Windows that allows you to view the user names and passwords stored by Google Chrome Web browser. For each password entry, the following information is displayed: Origin URL, Action URL, User Name Field, Password Field, User Name, Password, and Created Time. You can select one or more items and then save them into text/html/xml file or copy them to the clipboard.

Or AIO

WebBrowserPassView is a password recovery tool that reveals the passwords stored by the following Web browsers: Internet Explorer (Version 4.0 - 8.0), Mozilla Firefox (All Versions), Google Chrome, and Opera. This tool can be used to recover your lost/forgotten password of any Website, including popular Web sites, like Facebook, Yahoo, Google, and GMail, as long as the password is stored by your Web Browser. After retrieving your lost passwords, you can save them into text/html/csv/xml file, by using the 'Save Selected Items' option (Ctrl+S).