What should I code? - Hello, World and beyond...
When I start to learn to code in a new language, I can never think of any way to practise it, since I rarely learn it with a particular task in mind, so I thought I'd start a thread with a list of suggestions.
Some times I resort to looking through the code bank for what others have done.
I thought I'd roughly split them into suggested types and easiness (an estimate).
Hello World! goes without saying.
Procedural Easy:
- Prime number generator - http://en.wikipedia.org/wiki/Prime_number
- Hash cracker - wordlist
Intermediate
- CMS - simple blog style (no users)
Hard
- Hash cracker bruteforce
OOP Easy
- Address book - with contacts as objects.
Hard
Perl/Python/Ruby Easy
HTTP server - pythons basic http server makes it almost too easy.
C Intermediate
Basic hardware driver - I'd suggest on linux)
misc [b]php[b] Intermediate
A FTP/HTTP log desktop widget. - Using gkt
For less general ideas check the thread body
Seeing as I'm stuck for things to do, please post suggestions, and if you know what it's suited to and how difficult. Or just if you don't agree with my choices.
well, I would suggest that you write a network application of some sort for the intermediate level, and it can be anything related to computer networks.
I would also suggest you write a game or two, nothing two difficult.
btw, there's no comma in Hello World! most of the tutorials I read don't have that, and even Wikipedia confirms that it is Hello World.
Right now i am doing all in one Alternate Registry Editor(medium) / Port Watcher(medium) / Process Controller(hard) / Start-up editor (easy) / Policy Editor (easy) / With automate controls (easy)
Next i am working on a audio editor so you can edit audio based off frequency manipulation for mp3s and wavs. (medium - hard)
Compromise wrote: Write your own driver in C, you'd need to purchase some hardware though.
O.o more info about this would be appreciated. Where do I start (assuming I know C)? :P
@ topic: PHP/Python:
- Random website generator –> generate random websites depending on given input by user (such as colors).
PHP:
- Create your own forum + admin-panel + login script
A good one for python when first learning GUI modules would be a basic text editor of some sort. Eg: have a place to enter the file name and it will retrieve the file and put it into the main textbox. Allow saving and if you wanted to add a bit of a challenge you could include a file browser for the open file function.
there are lots and lots of problems to be solved on that site =)
what? SET is also working on a registry editor? just when I thought I can delay working on it for a while due to college, someone else comes in an does the same thing.
and wolf, it somehow matters a lot to me on how Hello World! should be written. I'm somehow attached to it, the same way I'm attached with my bike, even though it is lacking one pedal.
I see you haven't added my PHP-GTK suggestion. If you haven't added it because you don't know under which difficulty to file it, I suggest you put it in "Intermediate", or at least medium. Due to the lack of documentation/help/usage it's pretty rough to get going with it. It's also awesome.
If you haven't added it for another reason you can ignore this.
Here are my thoughts. Take something that you have programmed in another language, and try to get it working in said new language. That is the best place to start. You already know what it should do and you know what you are striving for. Once you have that you can then think of things that you always wanted that application to do, and try to make it happen.
Just my thought. Did not read through the entire posting though so this could have already been said.
A completely different idea. But recently I bought a small demo board thats fun to program some different things with.
http://www.axman.com/ is one example of some boards that can be combined with all sorts of different hardware (motors/sensors/etc) and computers to do nifty things.
Can get pricey but throwing it out there.
fuser wrote: and wolf, it somehow matters a lot to me on how Hello World! should be written. I'm somehow attached to it, the same way I'm attached with my bike, even though it is lacking one pedal.
cellotaping that broken pedal to yoru foot like I do too? Also I wasn't sure you were joking, so edited :D
Compromise wrote: I see you haven't added my PHP-GTK suggestion. If you haven't added it because you don't know under which difficulty to file it, I suggest you put it in "Intermediate", or at least medium. Due to the lack of documentation/help/usage it's pretty rough to get going with it. It's also awesome.
If you haven't added it for another reason you can ignore this.
Yeah basically wasn't sure where to put it, mainly cause I realised people devide up language in thier head different to I.
Aldar, I totally agree, it's just that sometimes something in one language doesn't really lend it's self to another and I feel like I should use X to do this and Y to do that, ya get meh?
wolfmankurd wrote: Yeah basically wasn't sure where to put it, mainly cause I realised people devide up language in thier head different to I.
That doesn't make any sense :P, and the reason you gave before you edited your post was better.
Anyhow, PHP-GTK isn't a programming language, it's just PHP using a (butchered) GTK lib. You might want to file it in your list as PHP, and mention using PHP-GTK in the description of the programming task.
Compromise wrote: That doesn't make any sense :P, and the reason you gave before you edited your post was better.
I guess it's hard to describe, but for example, I never learnt perl or ruby because I consider them in the same niche as python. (whilst some of the hardcore perl peeps always seem to differ on that)
wolfmankurd wrote: Aldar, I totally agree, it's just that sometimes something in one language doesn't really lend it's self to another and I feel like I should use X to do this and Y to do that, ya get meh?
That is why I suggested it :evil: that is the best way to learn. You take a tool that you liked the code for, and make it work in the new language. That is the best way to learn ;)
If all you ever do is code what you are comfortable with, you will not get to a point where you strive to get better. If you keep challenging yourself and pushing your boundaries, you have now given yourself the title of hacker.
That is my thoughts on the matter any ways. Someone who strives to better themselves and thirsts for knowledge is a hacker. What type of knowledge you are attempting to obtain gears you to what type of hacker you are.
Compromise wrote: If you haven't added it because you don't know under which difficulty to file it, I suggest you put it in "Intermediate", or at least medium. Due to the lack of documentation/help/usage it's pretty rough to get going with it. It's also awesome.
I second that. PHP-GTK is fun to work with, especially if you're already an avid PHP programmer. There's an example in the Code Bank that uses PHP-GTK for a desktop RSS reader: http://www.hellboundhackers.org/code/php-gtk-rss-feed-reader-1182_php.html
Some of the best programming challenges are the ones where you brave uncharted waters. PHP is primarily a web programming language, but using it in CLI or with PHP-GTK (or whatever else) can be a fresh perspective.
It seems from a couple of your posts that you lean more towards Python than other languages. Have you tried using Django or mod_python to use Python on the web? Have you written any Metasploit modules?
Maybe write a desktop application that monitors your Private Messages, threads you've posted in and such on here? A library that simplifies common GUI patterns with your favorite UI library (GTK/Qt/XWindows) using any language.
… A shoutbox bot? :P
MoshBat wrote: Long time since I've looked at it, but I think most are in ruby, but it's unlikely that you can't use Python, or any other language, for that matter.
Knowledge of Ruby is required, but anyone with experience in Perl or Python can pick up the basics in a couple days.¹
Sounds like they want you to port whatever you have to Ruby.
MoshBat wrote: [quote]SET wrote: But In Windows .Net Framework –– EASY Because the FUCKING PROGRAM WRITES IT FOR YOU. We've been over this a few times, love .NET all you want, but not all of us use, or like it. Please stop licking it's arsehole, and suggesting we all do the same.
Because I hate Visual Studio, I went ahead and installed it. Well, the C++ version, chosen because I assumed I might have to write about ten lines, and produced this basic GUI in about… Three mouse clicks. http://i151.photobucket.com/albums/s138/moshbat/FuckNet.png Yes, that was easy, very, very, very easy… I can see why you use VB, SET. I much doubt you have the capacity to try anything else.[/quote]
ooo wide screen laptop?
MoshBat wrote: [quote]wolfmankurd wrote: ooo wide screen laptop? How many Laptops have you seen with 22" screens? (I also have a 24 and 23, but for the sake of image/file size, I use the 22 for screencaps) And an ASUS Motherboard, and ATI Graphics Card? Also, if I had not cut off the other two screens, you'd have seen that my processor was running at 4.1GHz. Really, Wolfman, really?[/quote]
lol, I assumed it was laptop cause of the wifi,
That's how I spent most of my a levels but my calculator is hacked to be a FX-991ES, and the keys don't match the markings so idk anymore. I should update that title thingy but I'm not sure how I set it in the first place.
[edit] Ah yes and the topic, no one has really posted anything that is just seems to perfectly suit the language, can anyone think of one?
Compromise wrote: [quote]define wrote: … A shoutbox bot? :P
I'll fucking kill anyone who is going to make one and use it. Fucking kill, people. That means DEAD.[/quote]
Sorry you knew this had to be coming after that statement. Anywho a pygtk desktop widget for HBH shoutbox. Granted the code really does suck, I just sorta threw it together.
#!/usr/bin/python
import gtk, urllib2, cookielib, urllib, re, math
def strip_html_tags(line):
p = re.compile(r'<.*?>')
return p.sub('', line)
def SendShout(text):
login_data = urllib.urlencode({'user_name' : '<USERNAME>',
'user_pass' : '<PASSWORD>',
'login' : 'Login'
})
resp = opener.open('http://www.hellboundhackers.org/index.php', login_data)
resp.close()
shout_data = urllib.urlencode({'shout_message' : text,
'post_shout' : 'Shout'
})
resp = opener.open('http://www.hellboundhackers.org/index.php', shout_data)
resp.close()
return
def GetShouts():
sPage=opener.open('http://www.hellboundhackers.org/shoutbox/shoutbox_archive.php')
data=[]
tmp=0
tablestart=0
tableend=0
for line in sPage.readlines():
if line=="<table width='100%' cellpadding='0' cellspacing='1' class='tbl-border'>\n":
tablestart=tmp
if line=="<div align='center' style='margin-top:5px;'>\n":
tableend=tmp
if tablestart > 0 and tableend==0:
data.append(strip_html_tags(line))
tmp+=1
for i in range(len(data)):
try:
if data[i] == "\n" and data[i+1] == "\n":
del data[i]
except:
pass
del data[0]
del data[32:]
for i in range(len(data)):
blah = math.floor(len(data[i])/40)
if blah == 1:
tmp=list(data[i])
tmp.insert(40,'\n')
tmp="".join(tmp)
del data[i]
data.insert(i, tmp)
if blah == 2:
tmp=list(data[i])
tmp.insert(40,'\n')
tmp.insert(80,'\n')
tmp="".join(tmp)
del data[i]
data.insert(i, tmp)
shouts = "".join(data)
sPage.close()
return shouts
class ShoutBox(object):
def on_sendbutton_clicked(self, sendbutton):
self.window.destroy()
SendShout(self.entry.get_text())
ShoutBox()
def on_refreshbutton_clicked(self, refreshbutton):
self.window.destroy()
ShoutBox()
def __init__(self):
vb=gtk.VBox()
self.label = gtk.Label(GetShouts())
vb.pack_start(self.label)
self.entry = gtk.Entry()
vb.pack_start(self.entry)
sendbutton = gtk.Button(stock=gtk.STOCK_OK)
vb.pack_start(sendbutton)
refreshbutton = gtk.Button(stock=gtk.STOCK_REFRESH)
vb.pack_start(refreshbutton)
sendbutton.connect('clicked', self.on_sendbutton_clicked)
refreshbutton.connect('clicked', self.on_refreshbutton_clicked)
self.window = gtk.Window()
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
self.window.add(vb)
self.window.move(100,100)
self.window.show_all()
if __name__ == '__main__':
global cj, opener
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
opener.addheaders.append( ('Referer', 'http://www.hellboundhackers.org/index.php') )
sb = ShoutBox()
gtk.main()
MoshBat wrote: Because the FUCKING PROGRAM WRITES IT FOR YOU. We've been over this a few times, love .NET all you want, but not all of us use, or like it. Please stop licking it's arsehole, and suggesting we all do the same.
Because I hate Visual Studio, I went ahead and installed it. Well, the C++ version, chosen because I assumed I might have to write about ten lines, and produced this basic GUI in about… Three mouse clicks. http://i151.photobucket.com/albums/s138/moshbat/FuckNet.png Yes, that was easy, very, very, very easy… I can see why you use VB, SET. I much doubt you have the capacity to try anything else.
Your mad because it does most of the work for you…. Do you hate progress….java has javabeans and are you mad at that…. I mean if we are all getting angry at progress then God knows your lazy asses all use compilers…….Since we are completely full of ourself MOSHBAT why not just go all the way back to assembly and then dont use any premade dlls……or OS dlls because seriously you didnt build them …… I just cant believe that most of you want to stop the progress of how programming is done. Why the heck do we need case sensitive languages,What benefit does that do. You hate .net becuase it took you a few mouse clicks to create a gui …GREAT thats how the future of programming should be becuase writing the long code for guis over and over and over again is a waste of time when you can focus on the meat of the program and not just the visual aspects. But God forbid that we progress in programming languages….everybody pull out your punch cards.
Why am i stuck with retarded people…SO i don't see it from another view? i can see why you think that, I do promote .net a little to much….but saying .net isn't cross platform just makes you ignorant (Mono Project). Also If i choose to write DateTime or datetime or dateTime shouldnt be defined by a compiler. Aldo having to declare a variable is freaking stupid. Why do i have to write Dim mostbat as Asshole when i should be able to declare its datatype anywhere i want like dim moshbat moshbat = "asshole" your mad because anyone can program because of .net. Dont get pissed because anyone can program….get pissed because your programming skills suck a big meaty one while the world evolved….why walk when you can drive a car. The programming world will evolve and you will be worthless. Linux has its own set of tools for building guis and also coding easier hell PHPdesigner 2008 does all your php for ya pretty much……Open your eyes Mosh and evolve with the times instead of fighting them.
This thread is straying off topic. Stay on topic.
@SET - You had better settle down. Since you came back nearly every post of yours has been some sort of flame/rant/argument.
MoshBat wrote: [quote]ynori7 wrote: This thread is straying off topic. Stay on topic.
@SET - You had better settle down. Since you came back nearly every post of yours has been some sort of flame/rant/argument. He can't stand to have .NET bitched about, much less himself. Have the warn button ready. /prediction.
Another thing for new languages would be a simple rootkit. Granted, it's a bit malicious, but it does cover encryption and sockets to name two.[/quote]
For a bit more of a challenge, and a good one for messing with threads, would be to have the rootkit server have the ability to accept and manage connections from multiple clients at once. Then the person operating the server could switch between clients, and be notified when new clients connect or go offline and so on.
It was a pretty decent challenge for me to do in python, although that was my first experience with threads so it would probably be much easier for more experienced programmers.
MoshBat wrote: [quote]stealth- wrote: [quote]MoshBat wrote: [quote]ynori7 wrote: This thread is straying off topic. Stay on topic.
@SET - You had better settle down. Since you came back nearly every post of yours has been some sort of flame/rant/argument. He can't stand to have .NET bitched about, much less himself. Have the warn button ready. /prediction.
Another thing for new languages would be a simple rootkit. Granted, it's a bit malicious, but it does cover encryption and sockets to name two.[/quote]
For a bit more of a challenge, and a good one for messing with threads, would be to have the rootkit server have the ability to accept and manage connections from multiple clients at once. Then the person operating the server could switch between clients, and be notified when new clients connect or go offline and so on.
It was a pretty decent challenge for me to do in python, although that was my first experience with threads so it would probably be much easier for more experienced programmers.[/quote] Having a server that allows for multiple connections serves little purpose, as most are simply a quick way into a machine. Presumably, the only person who's going to use it would be you, and likely in one terminal. As an exercise, yeah, it would make a good one, but there's little point to it… A web server would be better for that kinda practise – and I'm sure that's already been suggested.[/quote]
Sorry, I think I might have explained my idea wrong. I had meant this in a situation where the hacked computer calls back to the malicious hacker. Not the hacker connecting to the hacked computer. If the hacker was connecting to the users system, then yes, threading would be pointless. However on the hackers computer, if there were multiple hacked computers and the server only accepted one connection at a time it could be rather confusing to get access to the machine you actually want.
MoshBat wrote: [quote]stealth- wrote: Sorry, I think I might have explained my idea wrong. I had meant this in a situation where the hacked computer calls back to the malicious hacker. Not the hacker connecting to the hacked computer. If the hacker was connecting to the users system, then yes, threading would be pointless. However on the hackers computer, if there were multiple hacked computers and the server only accepted one connection at a time it could be rather confusing to get access to the machine you actually want.
You seem to be confusing client with server… The server opens up a port, allowing the client to access it. Client sends commands, server process them. The program on the target machine would be called the server, and the client is the program you use to connect to it. 'T'least, this was the way I always understood things.[/quote]
Think of this as a reverse shell. The machine running the code does not open up a port to receive connections (and is hence not the server, but a client), but instead connects to the attackers machine (which has a open port and is listening, and hence is the server). This is so firewalls on the home/company router do not interfere, like they would if the hacked machine opened its own port (server) and the hacker tried to connect. The router would obviously drop the packet, because port forwarding would not be set up. The server then sends the client data informing it what commands to run, and the client (obviously) sends back the output.
A server is defined by the machine listening for connections. It doesn't really matter what is getting sent over the connection.
Huh. Interesting idea, I've never considered anything like that. With a setup like that, I do have to admit you've got a good point.
Either way, though, that particular setup of mine I was explaining was based around a network with a very strict firewall. However if I was to make a new rootkit in the future, I would probably base it around your idea.
Out of curiosity, though, you said you can configure firewalls to port forward, how the would you do that? With the variety of routers, I don't think it would be that easy.
edit: Nevermind, a quick wikipedia search answered my own question. :)
well, I just installed avg free on my windows 7 install, and all it found were "tracker cookies" does avg have a build in firewall? I think windows built in one is enough for me.
suppose it depends on the type of website you go on. I honestly can't think of one I visit that I could pick something up from.
AldarHawk wrote: [quote]wolfmankurd wrote: well, I just installed avg free on my windows 7 install, and all it found were "tracker cookies" does avg have a build in firewall? I think windows built in one is enough for me.
For free AV systems i prefer Avast, it is anti-virus, anti-rootkit and email scanning.[/quote]
Never used it, but if it's free I'll certainly check it out.
MoshBat wrote: +1
Been using shoes for years… Very good. Noted. If I ever have doubts about footwear, I'll be sure to post in a thread that had a different topic originally (for a short time, granted) with the aim of reassuring myself about footwear.
At the moment, though, I believe we're discussing AV software. Unless I do a benchmark of multiple AV programs with a crapped-down, virus-laden Windows virtual machine, I can only speak on experience – and best experiences at that.
So, what is your AV preference when using Windows?
MoshBat wrote: My point was that you (presumably) clicked the +1 button his post, due to AV preference, and if you didn't, well. Impressions count.
I've already mentioned my preferred, in passing at least. The only one I tested that detected my rootkit (in part, at least). But, with two high recommendations, and a supposed rootkit scanner (as most do these days), I'll test Avast. ZoneAlarm. No, I don't +1/-1 any post. I did agree with his AV preference, and I typed "+1" instead of "I agree" or "ditto" because I was in a typeful commenting mood. Technically, though, since I put it in quotes now, I think I just typecasted my response into relative irrelevance.
… Anyways, yes, I noticed that you mentioned ZoneAlarm; I just thought you were joking. ZA is decent for an application-level firewall, but it's kinda weak as an AV program. At least, that's how I see it, and I'm sure you'll express your side of it.
It's all preference but, when multiple options may be discussed, it helps to have more than one person throwing a good option out there.
dude, tell me about it.
I once read an issue of a local computer magazine that was basically a masturbatory tribute for kapersky.
The headline for the magazine: Win Kapersky 10! Interview with Eugene Kapersky! Kapersky 10 reviewed!
and then, after flicking through the articles, I read the technical help section, and one of the questions was "what is the best anti-virus for my pendrive ?" instead of pointing out at portableapps.com, the technical guy also answered kapersky.
and if that wasn't good enough, in the Linux help section of the same magazine, a guy asked the chances of infection in Linux (he's a newbie, bear with that person) and the columnist replied that while there are a few cases of viruses, it is nothing to worry about. However, since the same person also dual-boots (as he had mentioned in his letter) it is best that he uses kapersky.
at that point I just screamed incomprehensible things out loud, even though I was in the bus, which resulted in me being ejected from it. I then complained to the editor that the issue caused me being thrown out of a moving bus (well, it slowed down before they forced me out) into which he replied that's my problem.
MoshBat wrote: AVG: 3/30 (non-free was exactly the same) Norton: 10/30 McAfee: 20/30 Kaspersky: Absolutely none - and it took five hours. F-Secure: ~20, give or take a few BitDefender: <10 ZoneAlarm: Perfect score.
I'm not surprised that ZoneAlarm beat that list at the time, and things are still pretty much the same as that list, I'm sure. If anything, AVG has gotten a little better… and possibly Kaspersky. The rest are still crap.
Obviously, Avast is one that would be ideal to see on that comparison but, also, I'd be curious to see how Nod32 performed against the others. If Nod32 was free, I'd probably consider using it instead of Avast.
Well, I was going to recommend CastleCops for unbiased antivirus and antispyware comparisons, but it looks like they don't exist anymore. :whoa:
NO A/V
i know i am way ahead of my time. A/V cause more problems then you realize, and lots of viruses can shut down a/v's anyways. Best defense is know you PC OS like registry / policies / processes and you can kill most any virus(even though with google chrome i haven't gotten 1 virus and i tend to download alot from torrents. Also i love the performance boost i get without a A/V. Been virus clean for 1 1/2 years without the use of a anti-virus.
SET wrote: NO A/V
i know i am way ahead of my time. A/V cause more problems then you realize, and lots of viruses can shut down a/v's anyways. Best defense is know you PC OS like registry / policies / processes and you can kill most any virus(even though with google chrome i haven't gotten 1 virus and i tend to download alot from torrents. Also i love the performance boost i get without a A/V. Been virus clean for 1 1/2 years without the use of a anti-virus.
I'm with you, my personal opinion has always been A/V's aren't worth the pain in the ass they are. Although, I am more of a linux user so I don't have a whole lot of experience in that field.
i wasn't saying google chrome did. I just know if i didn't say some activity that involves the downloading and install of programs you would pop up and say something because you cant keep your mouth shut and let a typo/or obvious statement go without you obsessive need to prove you exists by throwing a comment that nether had anything to add or anything worth the time to read 90% of the time.