Author Topic: Kill The Net  (Read 122 times)

Robert

  • Hero Member
  • *****
  • Posts: 805
    • View Profile
Kill The Net
« on: December 16, 2021, 06:51:16 PM »
When some skript kiddie has hacked into your editor and is rearranging your deathless prose
here is a bit of code that you can use to instantly kill the net.
Code: [Select]
DIM TheExe$
DIM ExeParameters$
DIM Adapter$
Adapter$ = "Ethernet"

TheExe$ = "netsh"
ExeParameters$ = "interface set interface " & ENC$(Adapter$) & " disable"

ShellExecute(NULL, _
          "runas", _
           TheExe, _
    ExeParameters, _   
             NULL, _
          SW_HIDE)

To get the name of the adapter to kill run this
Code: [Select]
RUN "netsh interface show interface", SW_SHOW, 1

To connect back to the net use this
Code: [Select]
DIM TheExe$
DIM ExeParameters$
DIM Adapter$
Adapter$ = "Ethernet"

TheExe$ = "netsh"
ExeParameters$ = "interface set interface " & ENC$(Adapter$) & " enable"

ShellExecute(NULL, _
          "runas", _
           TheExe, _
    ExeParameters, _   
             NULL, _
          SW_HIDE)

Of course if you want to kill the skript kiddie you don't want to kill the net.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1106
    • View Profile
Re: Kill The Net
« Reply #1 on: December 16, 2021, 07:54:40 PM »
Another way that only involves 2 mouse clicks to disable / enable your connection

1) click on your network tray icon
2) click the Airplane mode button


Robert

  • Hero Member
  • *****
  • Posts: 805
    • View Profile
Re: Kill The Net
« Reply #2 on: December 16, 2021, 09:51:08 PM »
Another way that only involves 2 mouse clicks to disable / enable your connection

1) click on your network tray icon
2) click the Airplane mode button

Also with wireless, right click on the Internet Access Icon and click on Disconnect.

Not so with Ethernet. No disconnect button. You have to click a gazillion times to get to the disable the adapter icon at "Control Panel\Network and Internet\Network Connections".

Airplane mode? Doesn't kill Ethernet, only wireless.

I wanted a BCX, one click and wireless or hard wired dead, solution.

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1106
    • View Profile
Re: Kill The Net
« Reply #3 on: December 17, 2021, 06:56:41 AM »

I wanted a BCX, one click and wireless or hard wired dead, solution.

+1

Robert

  • Hero Member
  • *****
  • Posts: 805
    • View Profile
Re: Kill The Net
« Reply #4 on: December 17, 2021, 04:21:24 PM »
The following using the BCX RUN statement will work as well as ShellExecute if the .exe has a manifest attached with

level='requireAdministrator'

Code: [Select]

DIM TheExe$
DIM Adapter$
Adapter$ = "Ethernet"
TheExe$ = "netsh interface set interface " & ENC$(Adapter$) & " disable"
RUN TheExe$, SW_HIDE, 1


RUN wraps CreateProcess which needs a manifest if you want Administrator rights.

ShellExecute has the "runas" argument for the action to be performed parameter which elevates the execution to Administrator.

An Ethernet On/Off app like Doyle's BCX_Tray is being considered.