예제 #1
0
 public Carrier(Socks.Constants.Command command, params object[] args)
 {
     this.Command     = command;
     this.CommandTime = DateTime.Now;
     if (command == Socks.Constants.Command.Connect)
     {
         this.Data = new ConnectProxy(
             args[0] as IPEndPoint,
             (ProtocolType)args[1],
             args[2] as byte[]
             );
     }
     else if (command == Socks.Constants.Command.UdpAssociate)
     {
         this.Data = new UdpProxy(
             args[0] as IPEndPoint,
             (ProtocolType)args[1],
             args[2] as byte[]
             );
     }
     else
     {
         throw new NotImplementedException("Did not implement Carrier type " + command.ToString());
     }
 }
예제 #2
0
 public Command(Socks.Constants.Command socksCommand, IPEndPoint clientEndPoint, IPEndPoint proxyEndPoint, long wiredTx, long wiredRx, DateTime commandTime, bool success)
 {
     this.SocksCommand   = socksCommand;
     this.ClientEndPoint = clientEndPoint;
     this.ProxyEndPoint  = proxyEndPoint;
     this.WiredTx        = wiredTx;
     this.WiredRx        = wiredRx;
     this.CommandTime    = commandTime;
     this.Success        = success;
 }
예제 #3
0
        public async Task <object> CommitCommand(long accountId, Socks.Constants.Command command, System.Net.IPEndPoint clientEndPoint, System.Net.IPEndPoint proxyEndPoint, long wiredTx, long wiredRx, DateTime commandTime, bool success)
        {
            Plugin.IDatabaseConnection connection = await this.GetConnection();

            return(await this.CommitCommand(connection, accountId, command, clientEndPoint, proxyEndPoint, wiredTx, wiredRx, commandTime, success));
        }
예제 #4
0
        /// <summary>
        /// IDatabase.CommitConnection implementation for MySQL driver
        /// </summary>
        public Task <object> CommitCommand(Plugin.IDatabaseConnection clientImpl, long accountId, Socks.Constants.Command command, System.Net.IPEndPoint clientEndPoint, System.Net.IPEndPoint proxyEndPoint, long wiredTx, long wiredRx, DateTime commandTime, bool success)
        {
            VirtualConnection connection = clientImpl as VirtualConnection;

            uint sourceAddr = BitConverter.ToUInt32(clientEndPoint.Address.GetAddressBytes(), 0);
            uint targetAddr = BitConverter.ToUInt32(proxyEndPoint.Address.GetAddressBytes(), 0);

            connection
            .Command("INSERT INTO `commands` (`accountId`, `commandType`, `sourceAddr`, `sourcePort`, `targetAddr`, `targetPort`, `wiredTx`, `wiredRx`, `timestamp`, `success`) VALUES (@accountId, @command, @sourceAddr, @sourcePort, @targetAddr, @targetPort, @wiredTx, @wiredRx, @commandTime, @success);")
            .SetParameter("@accountId", accountId)
            .SetParameter("@command", command.ToString())
            .SetParameter("@sourceAddr", sourceAddr)
            .SetParameter("@sourcePort", clientEndPoint.Port)
            .SetParameter("@targetAddr", targetAddr)
            .SetParameter("@targetPort", proxyEndPoint.Port)
            .SetParameter("@wiredTx", wiredTx)
            .SetParameter("@wiredRx", wiredRx)
            .SetParameter("@commandTime", commandTime)
            .SetParameter("@success", success)
            .Execute();

            connection.IsBusy = false;
            return(Task.FromResult <object>(null));
        }