First Real Python Program!

the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
I've been trying to learn Python off and on for several years. Typically I'd go full tilt for a few weeks, finish the small project and then fall off the wagon. Until another project would come up and I would have to start all over. As I moved into mobile forensics I had a three day course on Python and was pretty motivated again. I ended up writing a piece of a program to decode some data via hex from a mobile app when our forensic suite finally had support for the app. Fast forward a few months and I was back to learning Python again. This time I used CodeSchool and it was pretty great. Got me right where I needed to be and I finally had a pretty big project.

We work with a lot of small firms and with that comes the chance to test new products to give them much needed feedback. We in turn get to have a say in things we'd like to see, though sadly not all of our suggestions make the grade. So we were testing a product and it worked pretty well along with integrated with another software suite we use. The problem? The interface is very clunky. It's fine for us, we use it everyday, but for other units it is a pain. Now they were using some open source hardware so I knew there is at least a little open source code there and thus getting to the data should be easier. Low and behold they are storing the data in text files, so yay Python!

I get to work and within a couple days I have a solid script that will parse all of the data in the various text documents and then load the data in a JSON database. Worked great, but it was ultra slow. A couple days worth of data was taking something like 20 minutes to load into the database and then queries were not working as well as I would have liked. I decide to go the sqlite route and bam the script loads the data in about 2 seconds. Perfect! But then the problem arose. I need timestamps and they are no where to be found. Thus I can tell you the day something occurs, but not the exact time. Reach out to the vendor, explain what I had thus far and he lays it on me: he used an algorithm to encode the time and he's pretty sure I won't figure it out (never a good thing to say to me). But he does offer to write a parser for me to decode the data. Excellent, I ask him to make it command line based with some flags.

It had been a couple months and I hadn't heard anything. Today I decided at the very least I should make the GUI. Mind you I have no experience in making a GUI in Python. Three hours later I have the GUI and modified the program so it works without issue (even has some error checking!). Had to speak with the vendor about a different issue and he asked if I had gotten the decoder he sent. I explained I hadn't received it and he resends it.

Now I just need to modify my code a bit and the heavy lifting part of the program will be done. There's some charting I want to do with the data and I'm looking at making a local web page to do that. But I'm also going to write a function to out put the data to csv so the Excel Nerds can go to town.

Moral of the story: as a friend once told me, if you want to program find a project and start. Get some of the basics, but other then that Google when you hit problems. I hit a couple of snags and was able to fix all of them through a little bit of Googling.
WIP:
PHP
Kotlin
Intro to Discrete Math
Programming Languages
Work stuff

Comments

  • NutsyNutsy Member Posts: 136
    Good stuff. Way to kill it.
  • the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
    Thanks! I was pretty happy about it. It's actually funny how often I'd say to myself "I wish I could do x or y". Really advantageous to be able to do things on your own.
    WIP:
    PHP
    Kotlin
    Intro to Discrete Math
    Programming Languages
    Work stuff
  • Danielm7Danielm7 Member Posts: 2,310 ■■■■■■■■□□
    Nice job. I've poked around in Python for awhile but keep getting pulled into other things instead. I'll have to try out that CodeSchool too.
  • UnixGuyUnixGuy Mod Posts: 4,564 Mod
    Well done!

    "Hello World" to the the world of Python!
    Certs: GSTRT, GPEN, GCFA, CISM, CRISC, RHCE

    Check out my YouTube channel: https://youtu.be/DRJic8vCodE 


  • jjones2016jjones2016 Member Posts: 33 ■■■□□□□□□□
    Good job buddy!
  • hiddenknight821hiddenknight821 Member Posts: 1,209 ■■■■■■□□□□
    I know just the feeling. Such a great feeling, isn't it? I used wxPython to create the GUI, but I was wondering if you have found other framework more convenient.
  • DatabaseHeadDatabaseHead Member Posts: 2,753 ■■■■■■■■■■
    the_Grinch wrote: »
    I've been trying to learn Python off and on for several years. Typically I'd go full tilt for a few weeks, finish the small project and then fall off the wagon. Until another project would come up and I would have to start all over.

    This is how it works for me. A project will require R, Python, VB. Completion takes place you back to your core role and a few weeks later another project springs up.

    I do like Python it easy and a strong 3 GL scripting language. R is EASIER but only good for stats and charts, at least the libraries I am familiar with....
  • the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
    I know just the feeling. Such a great feeling, isn't it? I used wxPython to create the GUI, but I was wondering if you have found other framework more convenient.

    I'm using tkinter. Very easy to use and I like using packages that are included with Python by default. Not the prettiest GUIs ever created, but it gets the job done.

    Thanks all for the support!
    WIP:
    PHP
    Kotlin
    Intro to Discrete Math
    Programming Languages
    Work stuff
Sign In or Register to comment.