Jump to content

pany03

Member
  • Posts

    18
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    Sweden

Everything posted by pany03

  1. Download Borland or Eclipse and start making programs in C. Best language ever!
  2. Easy peasy... #include<misc.au3> $dll=DllOpen("user32.dll") ;A Sloppy way to loop and check if F1 is pressed While 1 = 1 If _IsPressed(70,$dll) Then For $i = 1 To 100 ;The keys you want to send to the game Send("Send keys that makes me buy stuff") Sleep(1) Next EndIf WEnd You may want to change the sleep timer to work better with your game, its in ms. What keys do you want to send to the game??
  3. Hi, eventually I gave up on trying to resolve DNS with VB and used nmap instead. I use nmap to do a ping scan and save the result in an xml file, then I read the nmap xml file and list all hosts in the grid. But I didnt want a program that just read an xml file so I added an vnc connect column. Like this... Run the nmap bat and read the xml: Private Sub Nmap() Dim Proc As System.Diagnostics.Process Dim nmaprun As New System.Diagnostics.ProcessStartInfo("nmap.bat") nmaprun.WindowStyle = ProcessWindowStyle.Hidden Proc = System.Diagnostics.Process.Start(nmaprun) Proc.WaitForExit() readXML() End Sub Private Sub readXML() Dim dtgvupdate As New DataTable Dim xmldoc As XmlDocument Dim xml_nodelist As XmlNodeList Dim xml_node As XmlNode Dim address As String Dim name As String If (File.Exists("scan.xml")) Then xmldoc = New XmlDocument() xmldoc.Load("scan.xml") dtgvupdate.Columns.Add(New DataColumn("IP")) dtgvupdate.Columns.Add(New DataColumn("Hostname")) xml_nodelist = xmldoc.SelectNodes("/nmaprun/host/hostnames") For Each xml_node In xml_nodelist If xml_node.HasChildNodes Then address = xml_node.ParentNode.SelectSingleNode("address").Attributes("addr").Value name = xml_node.SelectSingleNode("hostname").Attributes("name").Value dtgvupdate.Rows.Add(address, name) xml_node.RemoveAll() End If Next DataGridView1.DataSource = dtgvupdate CreateGraphicsColumn() Else MessageBox.Show("No xml file") End If End Sub Add a VNC-connect column: Public Sub CreateGraphicsColumn() Try Dim vncIcon As New Icon("vnc.ico") Dim iconColumn As New DataGridViewImageColumn() With iconColumn .Image = vncIcon.ToBitmap() .Name = "VNC" .HeaderText = "VNC" End With DataGridView1.Columns.Insert(2, iconColumn) DataGridView1.Columns(2).Width = 80 Catch Dim tempcolumn As New DataGridViewButtonColumn DataGridView1.Columns.Insert(2, tempcolumn) DataGridView1.Columns(2).Name = "VNC" End Try End Sub Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick Dim ip As String Try If e.ColumnIndex = 2 Then ip = DataGridView1.Rows(e.RowIndex).Cells(0).Value.ToString Dim writer As System.IO.StreamWriter writer = File.CreateText("connection.bat") writer.Write("vncviewer.exe " & ip & " -password password") writer.Close() OpenVNC() End If Catch MessageBox.Show("Couldn't write .vnc file") End Try End Sub Sub OpenVNC() Try Dim Proc As System.Diagnostics.Process Dim vncrun As New System.Diagnostics.ProcessStartInfo("connection.bat") vncrun.WindowStyle = ProcessWindowStyle.Hidden Proc = System.Diagnostics.Process.Start(vncrun) Catch MessageBox.Show("Couldn't open VNC") End Try End Sub BTW i use UVNC viewer to connect to hosts.
  4. Thats wierd, when I run it on a windows server 2008 machine its slow. But when I run it on my local xp machine it takes about 30sec to fin. Maybe I should tweak the wait abit more, 1000ms is pretty slow for a DNS call.
  5. Hi finally something that works and pretty fast aswell... I would have liked to use threads for this but it just didnt wright anything in the grid. Anyway heres the code and if you want to try it out add a progressbar1, button1 and a datagridview1 to your form. Imports System Imports System.Net Imports System.Threading Public Class Form1 Public GetHostEntryFinished As ManualResetEvent = New ManualResetEvent(False) Class ResolveState Dim hostName As String Dim resolvedIPs As IPHostEntry Public Sub New(ByVal host As String) hostName = host End Sub Public Property IPs As IPHostEntry Get Return resolvedIPs End Get Set(ByVal value As IPHostEntry) resolvedIPs = value End Set End Property Public Property host As [String] Get Return hostName End Get Set(ByVal value As [String]) hostName = value End Set End Property End Class ' Record the IPs in the state object for later use. Public Sub GetHostEntryCallback(ByVal ar As IAsyncResult) On Error GoTo StopGetCallback Dim ioContext As ResolveState = ar.AsyncState ioContext.IPs = Dns.EndGetHostEntry(ar) StopGetCallback: GetHostEntryFinished.Set() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.ColumnCount = 2 DataGridView1.Columns(0).Name = "Hostname" DataGridView1.Columns(1).Name = "IP" DataGridView1.RowHeadersVisible = False End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Long Dim j As Long DataGridView1.Rows.Clear() 'Loop thrue addresses For i = 183 To 189 For j = 1 To 254 Try 'Call function that gets the hotname for us DoGetHostEntryAsync("10.110." & i & "." & j) Catch GoTo ResolveHost End Try ResolveHost: Next If ProgressBar1.Value < 85 Then ProgressBar1.Value = ProgressBar1.Value + 15 Else ProgressBar1.Value = 100 End If Next ProgressBar1.Value = 0 End Sub Public Sub DoGetHostEntryAsync(ByVal hostname As String) On Error GoTo StopDoGetHost GetHostEntryFinished.Reset() Dim ioContext As ResolveState = New ResolveState(hostname) 'Query DNS Dns.BeginGetHostEntry(ioContext.host, AddressOf GetHostEntryCallback, ioContext) 'Wait for DNS Query WaitHandle.WaitAny(New WaitHandle() {GetHostEntryFinished}, 1000) 'Resolve hotname and put in the grid right beside TRON Dim PCName As String = ioContext.IPs.HostName SetData({PCName, hostname}) StopDoGetHost: End Sub Private Sub SetData(ByVal [text] As String()) On Error GoTo CouldntAddRow Me.DataGridView1.Rows.Add([text]) CouldntAddRow: End Sub End Class Maybe I should go ahead and tag this thread with.... dns.begingethostentry , resolve hostname , networkscanner , VB? Oops I did. If somebody knows how to thread this code and still be able to wright to the datagrid.... pls make a post.
  6. Haha this starting to get so wierd... Im trying to use threads which Ive never used before on a function which I know little about. Anyway this is the code so far and it doesnt list anything in the datagridview but it runs pretty fast Imports System Imports System.Net Imports System.Threading Public Class Form1 Public Rows As List(Of String()) Public GetHostEntryFinished As ManualResetEvent = New ManualResetEvent(False) Class ResolveState Dim hostName As String Dim resolvedIPs As IPHostEntry Public Sub New(ByVal host As String) hostName = host End Sub Public Property IPs As IPHostEntry Get Return resolvedIPs End Get Set(ByVal value As IPHostEntry) resolvedIPs = value End Set End Property Public Property host As [String] Get Return hostName End Get Set(ByVal value As [String]) hostName = value End Set End Property End Class ' Record the IPs in the state object for later use. Public Sub GetHostEntryCallback(ByVal ar As IAsyncResult) On Error GoTo StopGetCallback Dim ioContext As ResolveState = ar.AsyncState ioContext.IPs = Dns.EndGetHostEntry(ar) StopGetCallback: GetHostEntryFinished.Set() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.ColumnCount = 2 DataGridView1.Columns(0).Name = "Hostname" DataGridView1.Columns(1).Name = "IP" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ' X button Me.Close() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' _ Button Me.WindowState = FormWindowState.Minimized End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim i As Long Dim j As Long 'Loop thrue addresses For i = 183 To 189 For j = 1 To 254 Try If j <> 50 And j <> 100 And j <> 150 And j <> 200 And j <> 250 And (i <> 189 Or j <> 254) Then Dim trd As New Thread(AddressOf DoGetHostEntryAsync) trd.IsBackground = True trd.Start("10.110." & i & "." & j) Else Dim trd2 As New Thread(AddressOf DoGetHostEntryAsync) trd2.IsBackground = True trd2.Start("10.110." & i & "." & j) trd2.Join() End If Catch GoTo ResolveHost End Try ResolveHost: Next ProgressBar1.Value = ProgressBar1.Value + 13 Next Try DataGridView1.DataSource = Rows Catch 'What to do? End Try ProgressBar1.Value = 0 End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click 'Fullscreen Me.Location = New Point(0, 0) Me.Width = Screen.PrimaryScreen.WorkingArea.Width Me.Height = Screen.PrimaryScreen.WorkingArea.Height Button1.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - 47, 3) Button2.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - 25, 3) Button4.Enabled = False Button4.Hide() DataGridView1.Width = Screen.PrimaryScreen.WorkingArea.Width - 40 DataGridView1.Height = Screen.PrimaryScreen.WorkingArea.Height - 60 DataGridView1.Location = New Point(20, 40) End Sub Public Sub DoGetHostEntryAsync(ByVal hostname As String) On Error GoTo StopDoGetHost GetHostEntryFinished.Reset() Dim ioContext As ResolveState = New ResolveState(hostname) Dns.BeginGetHostEntry(ioContext.host, AddressOf GetHostEntryCallback, ioContext) WaitHandle.WaitAny(New WaitHandle() {GetHostEntryFinished}, 1000) 'GetHostEntryFinished.WaitOne() Dim PCName As String = ioContext.IPs.HostName Rows.Add({PCName, hostname}) StopDoGetHost: End Sub End Class BTW Ive looked fairly little on your code gunsmokingman, so far. I will give it a go tonight.
  7. Thanks, I will have a look at it. Last night I tried to stop and whait for every 50th thread, like this: If j <> 50 And j <> 100 And j <> 150 And j <> 200 And j <> 250 Then Dim trd As New Thread(AddressOf DoGetHostEntryAsync) trd.IsBackground = True trd.Start("10.110." & i & "." & j) Else Dim trd As New Thread(AddressOf DoGetHostEntryAsync) trd.IsBackground = True trd.Start("10.110." & i & "." & j) trd.Join() End If But the program crashed after taking all the recources, both cpu and mem. I didnt know threads could be so complicated
  8. I tried to make threads. But the program started acting wierd.... At first run it doesnt list anything in the DataGridView and on the second run it only lists a few hostnames. But on the upside its a bit faster. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim i As Long Dim j As Long 'Loop thrue addresses' For i = 183 To 189 For j = 1 To 254 Try Dim trd As New Thread(AddressOf DoGetHostEntryAsync) trd.IsBackground = True trd.Start("10.110." & i & "." & j) Catch GoTo ResolveHost End Try ResolveHost: Next Next End Sub
  9. I tried to implement the code on a windowsform with 4 buttons and a DataGridView. But it's still a bit slow when I try to scan the subnet (15 min). I guess its cuz the application doesnt start more than one thread, it waits for the function to finish before it starts a new thread. Im gonna have a look around and see if somebody else has a better solution to this.... Anyway heres my code so far (badly commented), feel free to make adjustments and pls tell me where I've made stupid things happen: Imports System Imports System.Net Imports System.Threading Public Class Form1 Public GetHostEntryFinished As ManualResetEvent = New ManualResetEvent(False) Class ResolveState Dim hostName As String Dim resolvedIPs As IPHostEntry Public Sub New(ByVal host As String) hostName = host End Sub Public Property IPs As IPHostEntry Get Return resolvedIPs End Get Set(ByVal value As IPHostEntry) resolvedIPs = value End Set End Property Public Property host As [String] Get Return hostName End Get Set(ByVal value As [String]) hostName = value End Set End Property End Class ' Record the IPs in the state object for later use. Public Sub GetHostEntryCallback(ByVal ar As IAsyncResult) On Error GoTo StopGetCallback Dim ioContext As ResolveState = ar.AsyncState ioContext.IPs = Dns.EndGetHostEntry(ar) StopGetCallback: GetHostEntryFinished.Set() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DataGridView1.ColumnCount = 2 DataGridView1.Columns(0).Name = "Hostname" DataGridView1.Columns(1).Name = "IP" End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ' X button Me.Close() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' _ Button Me.WindowState = FormWindowState.Minimized End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim i As Long Dim j As Long 'Loop thrue addresses For i = 183 To 189 For j = 1 To 254 Try DoGetHostEntryAsync("10.110." & i & "." & j) Catch GoTo ResolveHost End Try ResolveHost: Next Next End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click 'Fullscreen Me.Location = New Point(0, 0) Me.Width = Screen.PrimaryScreen.WorkingArea.Width Me.Height = Screen.PrimaryScreen.WorkingArea.Height Button1.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - 47, 3) Button2.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - 25, 3) Button4.Enabled = False Button4.Hide() DataGridView1.Width = Screen.PrimaryScreen.WorkingArea.Width - 40 DataGridView1.Height = Screen.PrimaryScreen.WorkingArea.Height - 60 DataGridView1.Location = New Point(20, 40) End Sub Public Sub DoGetHostEntryAsync(ByVal hostname As String) On Error GoTo StopDoGetHost Dim Row As String() GetHostEntryFinished.Reset() Dim ioContext As ResolveState = New ResolveState(hostname) Dns.BeginGetHostEntry(ioContext.host, AddressOf GetHostEntryCallback, ioContext) ' Wait here until the resolve completes (the callback ' calls .Set()) GetHostEntryFinished.WaitOne() 'Add to datagrid Dim ip As IPAddress = ioContext.IPs.AddressList(0) Dim PCName As String = ioContext.IPs.HostName Row = {PCName, ip.ToString} DataGridView1.Rows.Add(Row) StopDoGetHost: End Sub End Class
  10. Ok, maybe I could been a bit more patient and read thrue the code one more time... Anyway this is what I came up with when I modified the code from MSDN: Imports System Imports System.Net Imports System.Threading Module Module1 Sub Main() DoGetHostEntryAsync("10.10.10.10") While 1 = 1 End While End Sub Public GetHostEntryFinished As ManualResetEvent = New ManualResetEvent(False) ' Define the state object for the callback. ' Use hostName to correlate calls with the proper result. Class ResolveState Dim hostName As String Dim resolvedIPs As IPHostEntry Public Sub New(ByVal host As String) hostName = host End Sub Public Property IPs As IPHostEntry Get Return resolvedIPs End Get Set(ByVal value As IPHostEntry) resolvedIPs = value End Set End Property Public Property host As [String] Get Return hostName End Get Set(ByVal value As [String]) hostName = value End Set End Property End Class ' Record the IPs in the state object for later use. Public Sub GetHostEntryCallback(ByVal ar As IAsyncResult) Dim ioContext As ResolveState = ar.AsyncState ioContext.IPs = Dns.EndGetHostEntry(ar) GetHostEntryFinished.Set() End Sub ' Determine the Internet Protocol (IP) addresses for ' this host asynchronously. Public Sub DoGetHostEntryAsync(ByVal hostname As String) GetHostEntryFinished.Reset() Dim ioContext As ResolveState = New ResolveState(hostname) Dns.BeginGetHostEntry(ioContext.host, AddressOf GetHostEntryCallback, ioContext) ' Wait here until the resolve completes (the callback ' calls .Set()) GetHostEntryFinished.WaitOne() Dim ip As IPAddress = ioContext.IPs.AddressList(0) Dim PCName As String = ioContext.IPs.HostName Console.WriteLine("IP : " & ip.ToString & " HOST : " & PCName) End Sub End Module
  11. Hi, Im not a programmer, Im more of a modifier. So i use alot of code from google and msdn... This time im trying to get hostnames with reversed DNS in VB 2010. At first I used: Dim PCName As IPHostEntry = Dns.GetHostEntry(IPAddress.Parse("10.10.10.10")) MessageBox.Show(PCName.HostName) But the delay was huge when i scanned the whole 10.10.x.x subnet, took me hours So i found some code for that on msdn... But I failed to modifie it to my needs. All I get is the IPadress or alot of errors. This is the code that i tried to modifie to get me the hostname from IP: Public GetHostEntryFinished As ManualResetEvent = New ManualResetEvent(False) ' Define the state object for the callback. ' Use hostName to correlate calls with the proper result. Class ResolveState Dim hostName As String Dim resolvedIPs As IPHostEntry Public Sub New(ByVal host As String) hostName = host End Sub Public Property IPs As IPHostEntry Get Return resolvedIPs End Get Set(ByVal value As IPHostEntry) resolvedIPs = value End Set End Property Public Property host As [String] Get Return hostName End Get Set(ByVal value As [String]) hostName = value End Set End Property End Class ' Record the IPs in the state object for later use. Public Sub GetHostEntryCallback(ByVal ar As IAsyncResult) Dim ioContext As ResolveState = ar.AsyncState ioContext.IPs = Dns.EndGetHostEntry(ar) GetHostEntryFinished.Set() End Sub ' Determine the Internet Protocol (IP) addresses for ' this host asynchronously. Public Sub DoGetHostEntryAsync(ByVal hostname As String) GetHostEntryFinished.Reset() Dim ioContext As ResolveState = New ResolveState(hostname) Dns.BeginGetHostEntry(ioContext.host, AddressOf GetHostEntryCallback, ioContext) ' Wait here until the resolve completes (the callback ' calls .Set()) GetHostEntryFinished.WaitOne() Console.WriteLine("EndGetHostEntry(" + ioContext.host + ") returns:") 'Console.WriteLine(PCName.HostName) Dim ip As IPAddress() = ioContext.IPs.AddressList Dim index As Integer For index = 0 To ip.Length - 1 Console.WriteLine(ip(index)) Next index End Sub I know that i can send either hostname or IP as string to the function. But what do I get in return, where is the hostname, is it hiding? I can run it out of the box with a hostname like "google.com" and i get several adresses in return. I wan't it to be the other way around. Please say that this is a hard question and that you wheren't able to find the answer on google....Cuz ive tried!
  12. Finally Bactrack is working... Thanks for your help jaclaz. Ive added a few more things to my USB and I wanna see how much I can fit in there. Anyway here is the code: timeout 30 color=white/blue title Xubuntu root (hd0,1) chainloader (hd0,1)+1 boot title BackTrack root (hd0,2) kernel /boot/vmlinuz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm APPEND vga=0x317 initrd /boot/initrd.gz title NTpassword root (hd0,3) kernel /NTpasswd/vmlinuz rw vga=1 initrd=/NTpasswd/initrd.cgz /NTpasswd/scsi.cgz initrd /NTpasswd/initrd.cgz title BOOT and NUKE root (hd0,3) kernel /memdisk initrd /dban.img title Memtest86 root (hd0,3) kernel /memdisk initrd /memtestp.img title SystemRescueCD root (hd0,3) kernel /rescuecd initrd=initram.igz video=ofonly vga=0 scandelay=5 initrd /initram.igz Now Im off to try Windows PE 2.0 and OPHCrack. /Pany03
  13. Woho I got Xubuntu working with this code: title Xubuntu root (hd0,1) chainloader (hd0,1)+1 boot Only backtrack left now. Tanks alot for the link!
  14. Hi, I found this great guide by Markymoo on how to install wingrub on my USB. So... I made 4 partitions on my USB and installed Wingrub on hd0,0 , xubuntu 8.10 on hd0,1 and backtrack on hd0,2. Both installations are persistence installtions from pendrivelinux. So i got wingrub working when i booted from my USB, but none of the linux installations boots. Ive tried these two menu.lst : timeout 30 color=white/blue title Xubuntu hide (hd0,0) hide (hd0,2) hide (hd0,3) unhide (hd0,1) rootnoverify (hd0,1) chainloader (hd0,1)+1 makeactive boot title BackTrack hide (hd0,0) hide (hd0,1) hide (hd0,3) unhide (hd0,2) rootnoverify (hd0,2) chainloader (hd0,2)+1 makeactive boot I got the messege "Boot error" on both partitions. AND this one: timeout 30 color=white/blue title Xubuntu root (hd0,1) kernel /casper/vmlinuz initrd /casper/initrd.gz boot title BackTrack root (hd0,2) kernel /boot/vmlinuz initrd /boot/initrd.gz boot This time I got a bit further... It tried to boot both partiotions but failed at reading som files from the root, maybe because the last code is ment to be used for distros that are fully installed to the hd. Am I not seeing the problem here? Is it an easy fix or should I just surrender to syslinux? Thanx /pany03
  15. I found it, its possible to import OE email accounts with reg files. Its actually quite easy, you can find it under HKEY_CURRENT_USER--> Software --> Microsoft--> Internet Account Manager.
  16. Hi, Im trying to make ppl auto import their email accounts when they log on to a domain. But Im having a hard time making a script that adds their email account to Outlook Express. The basic idea was to make a VB-script import an iaf file to Outlook Express. But I cant find any documentation on how to do it. Maybe theres a better way to do this...? It would be alot easier if you could just run a reg file..... maybe you can???
  17. Hi, Ive made a batch file that installs some programs auto..., but I cant figure out how to install SOS2000XP unattended. I havent found any switches for the application and the program needs some inputs when I install it (like: SQL server) so I think it needs an answerfile. Any ideas how to make this work?? Thanx /pany03
×
×
  • Create New...