Ctypes in Python

Invite Friends
Facebook Twitter Google+ LinkedIn Email
Description
Virtual Practice Lab
Practice Test
Resources
Ctypes in Python

Ctypes in Python

This lesson introduces the module and discusses what’s going to be covered over the entire course.

  • CtypesRegular expressions
  • Multithreading
  • Fuzzing

This particular lesson goes deep into Ctypes which is:

A means of using C code within a Python program

A way to do things that might not be included in Python or which require special modules/libraries

A lower-level language than Python

C-type has the following calling conventions:

  • Stdcall
  • Def foo
  • Cdecl
  • Def bar

In C code, you use a DLL (dynamically linked library) to gain access to functions from other code as well as various C type functions. Major DLLs are:

  • dll
  • dll
  • dll

Ctypes utilize memory addresses called Pointers, but they tend to be complicated and difficult to handle. However, the primary reason is the difference between passing by reference or passing by value:

  • C passes by reference: you pass the data’s address, rather than copying it all over
  • Python passes by value: when you pass a variable to a function, the called function copies the entire contents of that variable
  • When you pass by reference, you changes made to addressed data will show for any functions which access that data
  • In passing by value, you can do whatever you like to the data you receive, the original won’t be offered

Participants also learn about Ctypes functions:

  • Printf
  • MessageBoxA
Coming Soon
Learn on the go.
The app designed for the modern cyber security professional.
Get it on Google PlayGet it on the App Store
Practice Labs and Exam Vouchers

Congratulations! You're taking the first step to getting certified. Get some hands on experience with available practice labs OR save some money, support Cybrary, and purchase discounted exam vouchers. Ready to earn your next industry certification? Join cyber security's largest community and start learning today.

JOIN CYBRARY

Upcoming Industry Events

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 

Cybrary|0P3N

Skip to toolbar
Cybrary works best if you switch to our Android-friendly app
Continue

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel