Search
CBC Encryption
Wed Mar 25, 2015 6:41 pm by ORLP2
For those who don't know me, I am ORLP (lowercase or upper-case will do, I honestly aren't fussed). I am a Computer Science and cryptography enthusiast. I am looking to broaden my horizon within the "computer security" scene, even if that means joining a newly-crafted forum to get my name across and meet other people who have similar interests as me.
I would like to start by saying I'm …
I would like to start by saying I'm …
Comments: 0
Operating System Poll
Tue Mar 17, 2015 7:34 pm by Orianthi
So what operating systems do y'all use?
I use: Windows(7), Linux(Debian, Ubuntu, Mint, Arch Linux, Bieban, Fedora), OS X(Yosemite, Maveriks)
I use: Windows(7), Linux(Debian, Ubuntu, Mint, Arch Linux, Bieban, Fedora), OS X(Yosemite, Maveriks)
Comments: 0
Who is online?
In total there are 6 users online :: 0 Registered, 0 Hidden and 6 Guests None
Most users ever online was 14 on Mon Jun 01, 2020 9:21 pm
Ruby: A small parser that parses xat packets
Page 1 of 1
Ruby: A small parser that parses xat packets
- Code:
def parseXat(x)
return nil if !x #Returns nil if x is NilClass or FalseClass
return nil if !x["<"] or !x["/>"] or x.length < 3 or x.count('"') % 2 != 0 #Basic XML validation
b = ""#Empty string to fill raw string into.
f = 0 #Our flag keeps track of what's happening!
d = {"name" => "", "attributes" => {}} #Hash to put parsed data into!
for i in 0..(x.length-1)
if x[i] == "<" and f == 0
f = 1
elsif f == 1
if x[i] != " " and x[i] != "/"
b += x[i]
else
d["name"] = b
b = ""
f = 0
end
end
if x[i] == " " and x[i..-1]["="] and f != 2
f = 2
elsif f == 2
if x[i] != "="
b += x[i]
else
d["attributes"][b] = ""
f = 0
end
end
if x[i] == '"' and f != 3
f = 3
elsif f == 3
if x[i] != '"'
d["attributes"][b] += x[i]
else
#Then we check for for "'s. (Cause im too lazy to do all the escapes)
d["attributes"][b] = (d["attributes"][b]['"']) ? d["attributes"][b].gsub('"', '"') : d["attributes"][b]
b = ""
f = 0
end
end
if x[i] == ">"
break #Breaks when we reach a > (indicating our tag is done parsing)
end
end
return d
end
Shadow19- Moderator
- Posts : 4
Join date : 2015-03-16
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum