C/C++ for Hackers: Part 4 (Programming vs Scripting)

Part 4 (Programming vs Scripting)

welcome back, fellow hackers! as i already mentioned in the previous part of this series, i will make a special article where i will only talk about the differences between programming and scripting. and here it is! so with that out of the way, let's get started!

What Are Scripting Languages?

scripting languages and programming languages are not that different, actually. both are made to execute instructions on a computer. but there still are some key differences: scripting languages (like Bash, Python, Ruby...) are mainly designed to automate certain tasks (especially Bash). a lot of hackers use Python to write exploits (though i prefer doing it in Metasploit). scripting languages like python can have an extensive amount of functionality, but scripting languages have one big downside: they are slow. that is because unlike programming languages, scripts are interpreted, meaning that the program executes command per command, rather than throwing all commands together and translating it to machine code.

What Are Programming Languages?

programming languages are somewhat the opposite of scripting languages. programs are a lot faster than scripts because they get compiled. which means that the code gets translated to 1's and 0's and is able to interact directly with the CPU. this isn't the case with Python. Then again, programming languages also have a downside. they lack the flexibility offered by scripting languages. this doesn't mean that programming languages can't do much, however.

Conclusion

programming and scripting languages are different from eachother. there is no white and black when it comes to programming vs scripting. the perfect balance is using scripts and programs together. when you need to automate tasks, use a scripting language. when you need to make something fast, like an SSH password cracker, you should make it using C or C++

that's it for now folks! i made this tutorial because it seems that some people still confuse programming and scripting languages. i hope this clears things up for the newcomers! also, if you are interested in scripting, go check out master OTW's tutorials on scripting.

in the next part, we will learn more about the GNU GCC compiler and it's options.

-Phoenix750

13 Comments

Great serie so far. Thanks, looking forward for the next article.

that's right, though you can use Cython to optimize the speed of your python code.

It's critical in some tasks, like big data analysis and other things.

never heard of Cython before. will have a look at it.

-Phoenix750

Really great series! I am really looking forward to these:

  • Make a virus.
  • reprogram some hacking tools written in C/C++.
  • write some other cool software.

and i am looking forward to creating them! but before we can learn how to run, we must first learn to walk. we still have loops, the if statement, switch statement, pointers and all the rest to learn first.

-Phoenix750

dudeeee thank u soo much for this subject

but if i may i dont think u should give posts teaching the C programming coz it will take alot of posts ,,and everyone wants to learn C programming we all know this is not the place ,,,

i think u should just start with what FLOKI suggest it ,,
thnx again and waiting for ur next article ^_^

Prefer to write exploits in Metasploit rather than Python? I think you mean Ruby...

Finally! We have someone to well explain the difference between scripting and programming. When will Google get it?

Kudos, +1, no h8 m8 8/8 thru the g8, gr8! It's f8.

well, we know how google is, right?

and with "writing exploits in metasploit", i ment writing them using the metasploit framework.

thx m8 ik my tuts are gr8 but like you said it's f8.

-Phoenix750

My thoughts exactly. Metasploit is a framework that comes with written exploits (and more). Python, however, involves one to actually write the exploit. You can't really compare python with metasploit as they are totally different. You can, however, compare python and ruby; both which are used to write exploits.

A more correct article would have been "Compiled vs. Interpreted/ Scripting Languages." C++ is compiled, while Python is Interpreted. They are both programming languages.

python is high-level, interpreted language
while c/c++ is medium level compiled language

speed: c++>python
flexibility: c++< python
#libraries: c++<python

so my advice would be to write exploits or heavy(computational power wise) programs in c++/c and use python to automate the exploits.

ran through this series in 30 minutes. Its too easy when do we get to the challenging part. Except for those who do not know how to program.

I'm a little late to this party, but thanks for this epic post. I've got a question though, what's the verdict on freezing Python code to a Windows .exe file (using something like py2exe)? Does that compile the Python code and make it faster?

Ninja243

Share Your Thoughts

  • Hot
  • Latest