


 Lists and Kills system wide TCP/IP Connections

 This DLL COULD be used to create a Firewall in mIRC
 by monitoring new connections, and if a connection is
 present which you do not wish to be present you can
 disconnect it.

 CAUTION:
 This DLL uses 'Threads' to prevent mIRC from hanging
 but remember that a infinite timer could hang your mIRC
 because the DLL sends the entire list of your connections
 to the Signal. If you intend to use this to create
 a firewall in mIRC perhaps. Have a second delay atleast
 and use ''ListConnectionsEx'' and Remember Fast Timers
 mean more CPU.

 The reason i mentioned this above because i know
 that there will be people who will attempt exactly to do so.

 Good Luck,
 codemastr_
 


 /* Listing Connections
 
  Usage: /dll <dllpath> ListConnections
  Example: /dll iptable.dll ListConnections

  RETURN
  
    This function sends all the open connections to a mIRC
  Signal. The Signal name is 'ZIPTABLE'

 on 1:SIGNAL:ZIPTABLE:/echo -a $1-

  OUTPUT
  
   Example:
   	    Local Address: 192.168.1.102
  	    Local Port: 1131
   	    Remote Address: 72.143.138.80
   	    Remote Port: 18768
  	    State: 5

 Local Address
 
  This is the IP Address from the computer who has or is trying
  to established/close... a connection with the Remote Address.
  
  Note: If you are on a network the last digits may change
  returning to you which computer it is

 Local Port
 
  The local port number on the network of the TCP connection 
  on the local computer.

 Remote Address
 
  This is the IP Address from the computer who has or is trying
  to established/close... a connection with the Local Address.

 Remote Port
 
  The remote port number on the network of the TCP connection 
  on the remote computer.

  NOTE: This usually is the Port that you are connected or
  Connecting to

 State
 

 Note: Usually 5 means that you are Connected


 Definitions from Microsoft:

 1 The TCP connection is in the CLOSED state that represents no connection state at all.
 2 The TCP connection is in the LISTEN state waiting for a connection request from any remote TCP and port.
 3 The TCP connection is in the SYN-SENT state waiting for a matching connection request after having sent a connection request (SYN packet).
 4 The TCP connection is in the SYN-RECEIVED state waiting for a confirming connection request acknowledgment after having both received and sent a connection request (SYN packet).
 5 The TCP connection is in the ESTABLISHED state that represents an open connection, data received can be delivered to the user. This is the normal state for the data transfer phase of the TCP connection.
 6 The TCP connection is FIN-WAIT-1 state waiting for a connection termination request from the remote TCP, or an    acknowledgment of the connection termination request previously sent.
 7 The TCP connection is FIN-WAIT-1 state waiting for a connection termination request from the remote TCP.
 8 The TCP connection is in the CLOSE-WAIT state waiting for a connection termination request from the local user.
 9 The TCP connection is in the CLOSING state waiting for a connection termination request acknowledgment from the    remote TCP.
 10 The TCP connection is in the LAST-ACK state waiting for an acknowledgment of the connection termination request     previously sent to the remote TCP (which includes an acknowledgment of its connection termination request).
 11 The TCP connection is in the TIME-WAIT state waiting for enough time to pass to be sure the remote TCP received     the acknowledgment of its connection termination request.
 12 The TCP connection is in the delete TCB state that represents the deletion of the Transmission Control Block
 */

 /* Listing Connections Another Way
 
  Usage: /dll <dllpath> ListConnections
  Example: /dll iptable.dll ListConnectionsEx
  CAUTION: Do not forget the Ex at the end (Ex stands for Extended)

  RETURN
  
    This function sends all the open connections to a mIRC
  Signal. The Signal name is 'ZIPTABLE'

 on 1:SIGNAL:ZIPTABLE:/echo -a $1-

  OUTPUT
  
   CAUTION CAUTION CAUTION CAUTION CAUTION CAUTION
    This is where the difference stands.
    In the previous command every information had its own line, and it
    is tougher for scripters to list only perhaps the 'Connected' IPS
    This function is intended to ease that by simply placing everything on 1 line

   Example:
    Local Address: 192.168.1.102 - Local Port: 3193 - Remote Address: 72.143.138.80 - Remote Port: 18768 - State: 5


  CONSIDER THIS EXAMPLE

  on *:SIGNAL:ZIPTABLE:{
   if ($18) && ($18 == 5) { echo -a $1- }
  }
  ;: That example will list every CONNECTED IP (State = 5) when ListConnectionsEx is called.
 */


 /* Closing Connections
 
  Usage: //echo -a $dll(<dllpath>,KillConnection,<Local Address><Local Port><Remote Address><Remote Port>)
  Example: //echo -a $dll(iptable,KillConnection,192.168.1.102 2222 67.31.21.123 6667)
 
  If a match exists -- it will Close the 'Connection' between Your PC and the Remote PC
  by sending a (State 12) Message.

  Note: To Retrieve values use ListConnections or ListConnectionsEx

  RETURN
  
    This function returns "Killed <RemoteIP>"
 */

 Haso Keric
 hasokeric@comcast.net
 irc.efnet.net #WINAPI

