Coder Social home page Coder Social logo

server's Introduction

NFCGate Server

This is the NFCGate server application using Python 3 and the Google Protobuf library, version 3.

To run, simply start the server using python server.py. You can then connect to the server using the IP address of your device and the default port of 5566.
The server features a plugin system for data filtering. When starting the server, you can specify a list of plugins to be loaded as parameters, e.g. python server.py log. For an example, see the shipped mod_log.py plugin.

server's People

Contributors

kleest avatar malexmave avatar roussosalex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

server's Issues

Network: Error

Hello, may i ask....is ti possible to connect with server from phone with mobile data on and different ip from the machine where server is running ? I was trying and it show me on the app "Network:error" . Thanks in advance.

Error ( 00 6D 00) on APDUs

I'm sorry for the trouble, I want to mention that I managed to make the application, I installed the server properly with the protobuf library and python3 already installed. I mention that the phones are connected to each other, but when I want to do a test, it cannot process the transaction, telling me that the instruction is invalid.
I encountered that error before, but by updating the new protobuf I managed to make it functional.
What can i do ?
Now I have the newest version of protobuf, I also tried with the 2.6.1.
Need to try 3.x version of protobuf?
Thank you for your help and i apreciated you guys for all your work.

Congratulations for all of you!Screenshot 2024-02-03 165653

Nexus 5X: Xposed framework not recognised by nfcgate

I am currently running three different versions of the Xposed framework on three Nexus 5X devices, and the devices are running on different Android versions (6.0.1, 7.0, 8.1.0).

In all devices nfcgate does not recognise the Xposed framework, even if the nfcgate module is activated, and the framework is up and running. (Warning: missing Xposed module)

Is there any other activation to perform, or have you encountered the same issue in any other device?

Screenshot_20190724-135717
Screenshot_20190724-135709
Screenshot_20190724-135655

adding PCSC support to nfcgate

Hello, I'm trying to communicate from windows pc with Nfcgate server, I have not decided yet which is the best approach.
Can you please advise? below is an attempt I have made

import c2c_pb2.py, c2s_pb2.py
import socket
import socketserver
import struct
import sys
import datetime
from smartcard.System import readers
from smartcard.Exceptions import NoCardException

HOST = "0.0.0.0"
PORT = 5566

class PluginHandler:
# Existing PluginHandler code remains unchanged

class NFCGateClientHandler(socketserver.StreamRequestHandler):
# Existing init, log, and setup methods remain unchanged

def communicate_with_card(self, apdu):
    r = readers()
    if len(r) == 0:
        self.log("No smart card readers detected.", tag="SmartCard")
        return None

    try:
        connection = r[0].createConnection()
        connection.connect()
        response, sw1, sw2 = connection.transmit(apdu)
        return response + [sw1, sw2]
    except NoCardException:
        self.log("No smart card inserted.", tag="SmartCard")
        return None

def handle(self):
    # Existing handle setup code remains unchanged

    while True:
        try:
            # Existing code to read data from the socket remains unchanged

            # Here, integrate smart card communication
            # Convert data to APDU format if necessary
            apdu = list(data)  # Ensure it's in the correct format for pyscard
            card_response = self.communicate_with_card(apdu)
            
            if card_response is not None:
                self.log(f"Card response: {card_response}", tag="SmartCard")
                # Modify this part to send the card's response back
                # For example, you might send it directly back to the requester or to all clients in a session
                # This is a placeholder; adapt it to your needs
                self.wfile.write(struct.pack('!I', len(card_response)) + bytes(card_response))
            else:
                self.log("Error communicating with the card.", tag="SmartCard")

            # Break or continue based on your application's logic

        except socket.timeout:
            # Existing timeout handling remains unchanged

# Existing finish method remains unchanged

class NFCGateServer(socketserver.ThreadingTCPServer):
# Existing NFCGateServer code remains unchanged

if name == "main":
NFCGateServer((HOST, PORT), NFCGateClientHandler).serve_forever()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.