Monthly Archives: May 2014

VB strings seem to be binary safe

Code to test it:

Dim s1 As String = “”

        For i As Integer = 0 To 255
            Dim hexI As String = Hex(i)
            If hexI.Length = 1 Then
                hexI = “0” + hexI
            End If

            s1 = s1 + System.Text.RegularExpressions.Regex.Unescape(“\x” + hexI)
        Next

        For i2 As Integer = 0 To 255

            RichTextBox1.AppendText(Hex(Microsoft.VisualBasic.AscW(s1(i2))) + vbNewLine)
        Next

I didn’t check all values, but all values that could be used as delimiters(\x00 for instance) seem retrievable. Also, notepad tells me the richtextbox has 256 lines(plus one empty at the end).

You need a form and a richtextbox for this code(the code is public domain btw)

Advertisements

Leave a comment

Filed under Uncategorized

Separate file for the “header”

I think I’ll store meta information in a separate file. But I’ll let this idea mature a little before I get to coding.

Leave a comment

Filed under Uncategorized

VB rocks

When it comes down to GUI and cryptography, but sucks in everything else. I have a huge program and I’m not close to finishing my header-adding program, I would have already finished with few lines in python. Given that most users won’t need to add headers(only “webmasters”) I will move to python for this part. The worst part is that I don’t even know whether VB.net strings are binary-safe. That would easy my life somewhat.

Leave a comment

Filed under Uncategorized

getlocalip function…

…wasn’t completely useless now that I think about it. The IPAddress.Any property can be bound to a socket but it can’t display the external IPv4 address(it shows up as “0.0.0.0”)

Leave a comment

Filed under Uncategorized

Isn’t it curious that even if I bind a raw socket at ipaddress.any port 0 I still don’t get all traffic to my IP address(let alone my computer)?

Leave a comment

May 24, 2014 · 5:12 am

My getlocalip function at https://siliconvalleylatebloomer.wordpress.com/2014/05/19/essential-functions-getlocalip-and-byteartohex/ can be easily replaced(in fact, improved) by getting the property net.ipaddress.any instead o_O

Leave a comment

May 24, 2014 · 5:10 am

PHP(ish) function for visual studio 2010

Explode function in VB:

 

Private Function phpishExplode(ByVal del As String, ByVal s1 As String)
Dim returnValue As New ArrayList

Dim lastMatchIndex As Integer = 0
For i As Integer = 0 To s1.Count – del.Length
Dim match As Boolean = True
For i2 As Integer = 0 To del.Length – 1

If s1(i + i2) <> del(i2) Then
match = False
Exit For
End If

Next
If match = True Then
returnValue.Add(s1.Substring(lastMatchIndex, i – lastMatchIndex))
lastMatchIndex = i + del.Length

End If
Next
returnValue.Add(s1.Substring(lastMatchIndex, s1.Length – lastMatchIndex))

Return returnValue
End Function

Leave a comment

Filed under Uncategorized