Jump to content

[Version 1] [code] Save Ip-config As An .txt File


saibot559
 Share

Recommended Posts

void setup()
{
  WindowsCommandRun("cmd");
  delay(1000);
  ExecuteCommand("ipconfig");
  delay(1000);
  EditCMD(KEY_S);
  delay(1000);
  EditCMD(KEY_Y);
  delay(1000);
  ExecuteCommand("exit");
  delay(1000);
  WindowsCommandRun("notepad.exe");
  delay(1000);
  Keyboard.print("Ducky was here, and found an ip-config:");
  delay(1000);
  KeyCombo(MODIFIERKEY_CTRL,KEY_V);
  KeyCombo(MODIFIERKEY_CTRL,KEY_S);
  delay(1000);
  Keyboard.print("Ip-config File");
  delay(1000);
  KeyPress(KEY_ENTER);
  delay(1000);
  KeyCombo(MODIFIERKEY_ALT,KEY_F4);
  delay(1000);
}
void loop(){}

void WindowsCommandRun(char *SomeCommand)
{
  KeyCombo(MODIFIERKEY_GUI,KEY_R);
  delay(1000);
  Keyboard.print(SomeCommand);
  KeyPress(KEY_ENTER);
}

void KeyPress(int SomeKey)
{
  Keyboard.set_key1(SomeKey);
  Keyboard.send_now();
  ClearKeys();
}

void KeyCombo(int ModKey,int SomeKey)
{
  Keyboard.set_modifier(ModKey);
  Keyboard.set_key1(SomeKey);
  Keyboard.send_now();
  ClearKeys;
}

void ExecuteCommand(char *SomeCommand)
{
  Keyboard.print(SomeCommand);
  delay(500);
  KeyPress(KEY_ENTER);
}

void ClearKeys()
{
  Keyboard.set_modifier(0);
  Keyboard.set_key1(0);
  Keyboard.set_key2(0);
  Keyboard.set_key3(0);
  Keyboard.send_now();
}

void EditCMD(int SomeKey)
{
  KeyCombo(MODIFIERKEY_ALT,KEY_SPACE);
  KeyPress(KEY_E);
  KeyPress(SomeKey);
}

This code copy's the Ip-config found with CMD to a notepad file and then saves it as an text file on the desktop.

and although this might not be that usefull it does show the possibility of copying and pasting inside CMD.

I only tested it in XP but it should work on all windows boxes.

Link to comment
Share on other sites

  • 1 month later...
WindowsCommandRun("ipconfig > ipconfig.txt");

Hi!

Do you have any codes that can have the teensy store that file to an external drive? Since we could attach an SD card to the Teensy, I think we could come up with codes that can obtain documents and storing it on the memory card.

Thanks!

Bits1

Edited by BITS1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...