A little advice.. where do I even start?

A forum for general discussion of the Python programming language.

A little advice.. where do I even start?

Postby Rarien » Mon Dec 23, 2013 1:16 am

Soo.. I've been trying to get Python down for the past few days and I can't say it's going so well.
What I'm wanting out of python is some penetration testing, and mostly some program development(in minor forms.)

So far what I've done is I'm 20% into the http://codeacademy.com/ python guide. I've learned the syntax and a bit past that and I've gotta say..
I've yet to learn anything that's going to be useful to me. Of course things such as print and variables are DEFINITELY needed and I guess I can say
it's all really "needed" to be learned but I've looked around and I just can't learn anything further from here that coincides with what I'm wanting to do with python?
Hope that was clear..

See, I'm an intermediate (whatever that would be) in "Autohotkey" if anyone has ever heard of that, and I loved it buuuut it's not very professional.. it has it's limitations and it's sloooowwwwww and I've yet to see a high-quality program created by it.. so no thank you for that language. BUUUUT it had macros.. it was able to interact with applications and make it's own. Can I do this in python? Of course.. but how and where to learn it? I have no clue.. where do I even start? @_@
Last edited by Yoriz on Mon Dec 23, 2013 1:22 am, edited 1 time in total.
Reason: first post lock
Rarien
 
Posts: 1
Joined: Mon Dec 23, 2013 1:09 am

Re: A little advice.. where do I even start?

Postby metulburr » Mon Dec 23, 2013 2:53 am

Can I do this in python? Of course.. but how and where to learn it? I have no clue.. where do I even start? @_@

Where to start? Keep going with learning python. Read numerous books. Make many programs. Learn the language. Learn another language.

I've looked around and I just can't learn anything further from here that coincides with what I'm wanting to do with python?

you cant just pick and choose what you want to learn. The have to learn ALL if not most of the basics first. Especially if your goal is penetration testing. A few days is just scratching the surface.

I've yet to learn anything that's going to be useful to me.

It is all useful.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1562
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: A little advice.. where do I even start?

Postby Yoriz » Mon Dec 23, 2013 6:36 am

For the gui part of autohotkey see the gui frameworks listed in this post new to Python, need GUI advice
For the automation part see the following pywinauto
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Image
User avatar
Yoriz
 
Posts: 1164
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: A little advice.. where do I even start?

Postby Kebap » Mon Dec 23, 2013 12:37 pm

Yes you should definitely learn about python basics, like lists, dicts, functions, etc. Doesn't matter which problem you want to tackle. Did you program in other languages before?
Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 403
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: A little advice.. where do I even start?

Postby Bulgan » Wed Dec 25, 2013 4:40 pm

It depends of have you learnt any object oriented program language or not. If not, you should read about object oriented (class oriented) viewing on world, because it more philosophical aspect than cybernetical (I think Wikipedia is enough . Then I can recommend "Programming in Python 3: A Complete Introduction to the Python Language (2nd Edition)". Anothe GREAT book "Python Essential Reference" by David Beazley. The last book lead you through 2x and 3x. I recomend read both of them at the same time. After that just practice, practice and practice
Bulgan
 
Posts: 2
Joined: Sun Dec 22, 2013 8:56 pm

Re: A little advice.. where do I even start?

Postby Tcll » Wed Jan 01, 2014 9:00 pm

Python has alot of useful trickery...
you just have to know what's faster.

for example, how [].append(v) is roughly 3x slower than []+[v]

I'm not sure exactly what penetration is, but I do know that python can be fast if you use fast methods.
the only problems I've been having is memory issues (since Python is one of the most memory-hungry languages)

I work with Python 2.7 due to PyOpenGL being slower on Py3x,
and I have to say my program does it's work quite well. :)
(for using a slow method of a structured list of lists for my format)
^switching to classes would be muuch faster

you kinda have to know at least a little about Python's back-end to understand this,
but try to guess how many ticks a function/method would take to complete.
the more complex something is, the more likely it is to take longer (unless built efficiently)

and I don't speak of "complex" as 1 function accepting types...
I'm saying it depends on how many levels the interpreter has to go through before it completes.

for example, my __BIT() function which takes a number of data types, but only a few steps to parse them:
viewtopic.php?f=10&t=9989#p12753
User avatar
Tcll
 
Posts: 101
Joined: Wed Jan 01, 2014 6:36 pm

Re: A little advice.. where do I even start?

Postby stranac » Wed Jan 01, 2014 9:14 pm

Tcll wrote:for example, how [].append(v) is roughly 3x slower than []+[v]

This doesn't seem to be correct(and it's irrelevant 99% of the time):
Code: Select all
>>> from timeit import repeat
>>> repeat('[].append(3)')
[0.4234286532589522, 0.4145613492098619, 0.41935121268443254]
>>> repeat('[] + [3]')
[0.5789221370018254, 0.5592047553715247, 0.5662047723095611]

This timing also makes sense, since the second example creates 2 additional lists.

Anyway, the OP is asking how to start, and "useful trickery" is definitely not something he should be thinking about...
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1246
Joined: Thu Feb 07, 2013 3:42 pm

Re: A little advice.. where do I even start?

Postby Tcll » Wed Jan 01, 2014 9:23 pm

stranac wrote:
Tcll wrote:for example, how [].append(v) is roughly 3x slower than []+[v]

This doesn't seem to be correct(and it's irrelevant 99% of the time):
Code: Select all
>>> from timeit import repeat
>>> repeat('[].append(3)')
[0.4234286532589522, 0.4145613492098619, 0.41935121268443254]
>>> repeat('[] + [3]')
[0.5789221370018254, 0.5592047553715247, 0.5662047723095611]

This timing also makes sense, since the second example creates 2 additional lists.

Anyway, the OP is asking how to start, and "useful trickery" is definitely not something he should be thinking about...


try it with a for loop... don't run it standalone like that:
Code: Select all
print 'starting test1'
L1 = []
for i in range(100000): L1.append(0)

print 'done, starting test2'
L2 = []
for i in range(100000): L2+=[0]
print 'done'

take note of how long it takes for each test to finish.

I'm not sure about python3, but I know I'm right about python2
User avatar
Tcll
 
Posts: 101
Joined: Wed Jan 01, 2014 6:36 pm

Re: A little advice.. where do I even start?

Postby stranac » Wed Jan 01, 2014 10:02 pm

Tcll wrote:try it with a for loop... don't run it standalone like that

timeit.repeat() does 1 million loops by default.

But here's the testing using manual loops(just to make sure):
Code: Select all
>>> from timeit import repeat
>>> repeat('for i in range(100000): L.append(0)', 'L = []', number=1)
[0.030850272624945774, 0.020487291104331007, 0.0199411686507176]
>>> repeat('for i in range(100000): L += [0]', 'L = []', number=1)
[0.061386422184483536, 0.04244305621213584, 0.03666411569994921]

append still faster... using python 2.7.5
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1246
Joined: Thu Feb 07, 2013 3:42 pm

Re: A little advice.. where do I even start?

Postby Tcll » Wed Jan 01, 2014 10:13 pm

stranac wrote:
Tcll wrote:try it with a for loop... don't run it standalone like that

timeit.repeat() does 1 million loops by default.

But here's the testing using manual loops(just to make sure):
Code: Select all
>>> from timeit import repeat
>>> repeat('for i in range(100000): L.append(0)', 'L = []', number=1)
[0.030850272624945774, 0.020487291104331007, 0.0199411686507176]
>>> repeat('for i in range(100000): L += [0]', 'L = []', number=1)
[0.061386422184483536, 0.04244305621213584, 0.03666411569994921]

append still faster... using python 2.7.5

^1 person likes this

but that's wierd...
could it be that I'm using a single-core x86 machine and you're using an x64 machine??
(perhapse the interpreters manage data slightly different resulting in different performances)

I'm only talking from my experience of re-writing both UMC's file-handler AND the statue-builder for my last MC-schematic script.
in both cases, []+[] improved the speed greatly
User avatar
Tcll
 
Posts: 101
Joined: Wed Jan 01, 2014 6:36 pm

Re: A little advice.. where do I even start?

Postby stranac » Wed Jan 01, 2014 10:35 pm

Tcll wrote:could it be that I'm using a single-core x86 machine and you're using an x64 machine??

Nope.
Tcll wrote:I'm only talking from my experience of re-writing both UMC's file-handler AND the statue-builder for my last MC-schematic script.
in both cases, []+[] improved the speed greatly

That's weird. I have no explanation for that.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1246
Joined: Thu Feb 07, 2013 3:42 pm


Return to General Discussions

Who is online

Users browsing this forum: ichabod801 and 3 guests