Articles

Metasploit Framework Windows Tutorial
Remote Desktop Connection
Windows Processes That May Be Dangerous
How-To use NetCat a Tutorial
Common Linux Commands
Common Ports
Netcat Commands
HTTP Response Codes
War-Google Hack Terms
Wardriving
Avoiding Social Engineering and Phishing Attacks
Intrusion Detection on Linux
Linux Intrusion Detection
Penetration Testing Guide
Penetration Testing Tools
Social Engineering Fundamentals, Part I: Hacker Tactics
Social engineering (computer security)
The Psychology of Social Engineering

The Archives

General GSO
GovernmentSecurity.org News & Suggestions
In The News
Open Topic
General Security Information
Trash Can
Exploit & Vulnerability Mailing List Archives
Trial Member Forum
Product and Program Reviews GSO Tutorials
System Security
Windows Systems
Beginners Section
Linux & Unix Systems
File Downloads
Exploit Research & Discussion Trojan & Virus Errata
Networking Security / Firewall / IDS / VPN / Routers
System Hardening
E-Mail Security
Wifi Security
Trial Member Uploads
Upload discovered Trojans & Mal ware
GSO Programming Section
C , C++ , VC++
Visual Basic.NET
Perl /CGI
Java/Javascript
PHP/XML/ASP/HTML
Assembly + Other
The Cork Board
Network Security Consultant Directory
Network Security Jobs
The Archives
Encryption Information
General Network Security
Internet Anonymity
HTTP Protocol Security
Linux Security
MS IIS Information
Exploit Articles
Programming / Tool Design
GSO Software Projects
Public Downloads
Microsoft Security Questions and Papers

Full Version: Arrays, Fun Fun Fun!
chris105
Hey all

CODE


Private no as integer
Private stringout() as string

Private Sub win_DataArrival(ByVal bytesTotal As Long)
win.GetData rdata
'--------------------------
'==Message sending behind==
'--------------------------
If wout.State <> 7 Then
que = True
stringout(no) = rdata
no = no + 1
End If

If wout.State = 7 Then
no = 0
While stringout(no) > ""
wout.SendData stringout(no)
no = no + 0
Wend
que = False
no = 1

End If
End sub


I get an error that "substring is not in range" on this line "stringout(no) = rdata"
setthesun
First you have give fixed length or dynamicly resize the array;

Fixed style;
Private stringout(10) as string

Dynamicly;
Dim Newsize As Integer = 10
Redim Preserve stringout(Newsize)


Also Arraylist or some other collections in .NET could be better for this kind operations.
chris105
Great answer, thankyou very much setthesun, btw what is the max that this number can be? I set it as 100 just in case but I dont think I will need that many.
setthesun
QUOTE(chris105 @ Apr 24 2005, 07:38 AM)
Great answer, thankyou very much setthesun, btw what is the max that this number can be? I set it as 100 just in case but I dont think I will need that many.
*



I've no exact idea probably "max.integer" but be carefull it will fill up your memory smile.gif


QUOTE(chris105 @ Apr 24 2005, 07:38 AM)
I set it as 100 just in case but I dont think I will need that many.


It completly depends on the application, setting size to 100 is not important for one time code. But it's a bad idea for iteration with UBound(Array)

So if you're going to increase it dynamicly try something like this;

CODE

Sub push(ByVal Data As String, ByRef Arr As String())

Redim Preserve Arr(Ubound(Arr)+1)
Arr(Ubound(Arr)) = Data

End Sub



Then add new item by;
CODE

push("xxx", myArray)
A2_
you should be checking the state on win before you attempt to .GetData so that an 'invalid operation at current state' error never occurs. also, wouldnt dumping the array from the wout_connect event work better?
chris105
Didnt like the code at all so I rewrote it completely, will post it at the weekend.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2005 Invision Power Services, Inc.