Author Topic: [Python] Control CMD with python?  (Read 1594 times)

0 Members and 1 Guest are viewing this topic.

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
[Python] Control CMD with python?
« on: February 12, 2012, 06:36:34 pm »
I'm making a telnet-type of program. I can send and receive text fine, but I can not find how to have python export commands to CMD. I am making a kinda trojan thing to fuck with my friends. Any help would be awesome.
Blog: rexmckinnon.tumblr.com

Offline ande

  • Owner
  • Titan
  • *
  • Posts: 2664
  • Cookies: 256
    • View Profile
Re: [Python] Control CMD with python?
« Reply #1 on: February 12, 2012, 06:54:34 pm »
If you are going to use CMD for telnet I suggest you look into networking with python instead. But the system call will do what you want:

Code: [Select]
import os
cmd = 'ping google.com'
os.system(cmd)
« Last Edit: February 12, 2012, 06:54:57 pm by ande »
if($statement) { unless(!$statement) { // Very sure } }
https://evilzone.org/?hack=true

Offline Ragehottie

  • Knight
  • **
  • Posts: 313
  • Cookies: -9
  • Hack to learn, not learn to hack.
    • View Profile
Re: [Python] Control CMD with python?
« Reply #2 on: February 13, 2012, 01:04:07 am »
Thank ya very kindly sir.
Blog: rexmckinnon.tumblr.com

Offline xeross

  • NULL
  • Posts: 2
  • Cookies: 0
    • View Profile
Re: [Python] Control CMD with python?
« Reply #3 on: February 14, 2012, 12:22:32 pm »
I think it'd be a better idea to use the new subprocess module, that way you can control input/output streams

Offline Stackprotector

  • Administrator
  • Titan
  • *
  • Posts: 2515
  • Cookies: 205
    • View Profile
Re: [Python] Control CMD with python?
« Reply #4 on: February 16, 2012, 05:37:33 pm »
In the tutorial section there is a guide on networking with python, take a look!.
~Factionwars