AI prompts
base on An NFC research toolkit application for Android NFCGate
=======
NFCGate is an Android application meant to capture, analyze, or modify NFC traffic. It can be used
as a researching tool to reverse engineer protocols or assess the security of protocols against
traffic modifications.
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/de.tu_darmstadt.seemoo.nfcgate)
## Notice
This application was developed for security research purposes by students of
the [Secure Mobile Networking Lab](https://www.seemoo.tu-darmstadt.de/)
at [TU Darmstadt](https://www.tu-darmstadt.de/). Please do not use this application for malicious
purposes.
## Features
- **On-device capture**: Captures NFC traffic sent and received by other applications running on the
device.
- **Relay**: Relays NFC traffic between two devices
using [a server](https://github.com/nfcgate/server). One device operates as a "reader" reading an
NFC tag, the other device emulates an NFC tag using the Host Card Emulation (HCE).
- **Replay**: Replays previously captured NFC traffic in either "reader" or "tag" mode.
- **Clone**: Clones the initial tag information (e.g. ID).
- [pcapng](https://github.com/pcapng/pcapng) export of captured NFC traffic, readable by Wireshark.
## Requirements for specific modes
- NFC support
- Android 5+ (API level 21+)
- [Xposed](https://repo.xposed.info/)-compatible hooking
framework ([EdXposed](https://github.com/ElderDrivers/EdXposed), [LSPosed](https://github.com/LSPosed/LSPosed)
with Zygisk or Riru): On-device capture, relay tag mode, replay tag mode, clone mode.
- ARMv8-A, ARMv7: Relay tag mode, replay tag mode, clone mode.
- [HCE](https://developer.android.com/guide/topics/connectivity/nfc/hce): Relay tag mode, replay tag
mode, clone mode.
## Usage
### Building
1. Initialize submodules: `git submodule update --init`
2. Build using Android Studio or Gradle
### Operating Modes
As instructions differ per mode, each mode is described in detail in its own document
in `doc/mode/`:
- [**On-device capture**](doc/mode/OnDevice.md)
- [**Relay**](doc/mode/Relay.md)
- [**Replay**](doc/mode/Replay.md)
- [**Clone**](doc/mode/Clone.md)
### Pcapng Export
Captured traffic can be exported in or imported from the [pcapng](https://github.com/pcapng/pcapng)
file format. For example, Wireshark can be used to further analyze NFC traffic. A detailed
description of the import and export functionality is documented in [doc/pcapng.md](doc/pcapng.md).
## Compatibility
NFCGate provides an in-app status check. For further notes on compatibility see
the [compatibility document](doc/Compatibility.md).
## Known Issues and Caveats
Please consider the following issues and caveats before using the application (and especially before
filing a bug report).
### NFC Stack
When using modes, that utilize HCE, the phone has to implement
the [NFC Controller Interface (NCI)](https://nfc-forum.org/our-work/specifications-and-application-documents/specifications/nfc-controller-interface-nci-specification/)
specification. Most of the phones should implement this specification when offering HCE support.
### Confidentiality of Data Channel (relay)
To ensure confidentiality and integrity, use Transport Layer Security (TLS), which can be enabled in
NFCGate settings. You need a CA-issued or self-signed certificate. Certificates from system-trusted
CAs are trusted automatically. Self-signed certificates can be trusted by the user on first use (
TOFU).
### Compatibility with Cards (relay, replay, clone)
We can only proxy tags supported by Android. For example, Android no longer offers support for
MiFare classic chips, so these cards are not supported. When in doubt, use an application like NFC
Tag info to find out if your tag is compatible. Also, at the moment, every tag technology supported
by Android's HCE is supported (A, B, F), however NFC-B and NFC-F remain untested. NFC-A tags are the
most common tags (for example, both the MiFare DESFire and specialized chips like the ones in
electronic passports use NFC-A), but you may experience problems if you use other tags.
### Compatibility with readers (relay)
This application only works with readers which do not implement additional security measures. One
security measure which will prevent our application from working in relay mode is when the reader
checks the time it takes the card to respond (or, to use the more general case, if the reader
implements "distance bounding"). The network transmission adds a noticeable delay to any
transaction, so any secure reader will not accept our proxied replies.
This does not affect other operating modes.
### Android NFC limitations (relay, replay)
Some features of NFC are not supported by Android and thus cannot be used with our application. We
have experienced cases where the NFC field generated by the phone was not strong enough to properly
power more advanced features of some NFC chips (e.g. cryptographic operations). Keep this in mind if
you are testing chips we have not experimented with.
## Publications and Media
This application
was [presented at the 14th USENIX Workshop on Offensive Technologies (WOOT '20)](https://www.usenix.org/conference/woot20/presentation/klee).
An [arXiv preprint can be found here](https://arxiv.org/abs/2008.03913).
An early version of this application was presented at WiSec 2015.
The [extended Abstract](https://tuprints.ulb.tu-darmstadt.de/5414/1/NFCGate%20-%20Maass%20et%20al.pdf)
and [poster](https://blog.velcommuta.de/wp-content/uploads/2015/07/NFCGate-Poster.pdf) can be found
on the [website](https://blog.velcommuta.de/publications/) of one of the authors. It was also
presented in a
brief [Lightning Talk](https://media.ccc.de/browse/conferences/camp2015/camp2015-6862-lightning_talks_day_2.html#video&t=300)
at the [Chaos Communication Camp 2015](https://events.ccc.de/camp/2015/wiki/Main_Page).
## Reference our Project
Any use of this project which results in an academic publication or other publication which includes
a bibliography should include a citation to NFCGate:
```
@inproceedings {Klee2020Nfcgate,
author = {Steffen Klee and Alexandros Roussos and Max Maass and Matthias Hollick},
title = {NFCGate: Opening the Door for {NFC} Security Research with a Smartphone-Based Toolkit},
booktitle = {14th {USENIX} Workshop on Offensive Technologies ({WOOT} 20)},
year = {2020},
url = {https://www.usenix.org/conference/woot20/presentation/klee},
publisher = {{USENIX} Association},
month = aug,
}
```
The initial NFCGate paper describing the first version of NFCGate can be cited as follows:
```
@inproceedings{Maass2015Nfcgate,
title={DEMO: NFCGate: an NFC relay application for Android},
author={Max Maass and Uwe M{\"u}ller and Tom Schons and Daniel Wegemer and Matthias Schulz},
booktitle={Proceedings of the 8th ACM Conference on Security \& Privacy in Wireless and Mobile Networks},
year={2015}
}
```
## License
```
Copyright 2015-2024 NFCGate Team
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
## Contact
* [Steffen Klee](https://www.seemoo.tu-darmstadt.de/team/sklee/)
* [Max Maass](https://www.seemoo.tu-darmstadt.de/team/mmaass/)
## Used Libraries
- [xHook](https://github.com/iqiyi/xHook) (Licensed under
the [MIT License](https://opensource.org/licenses/MIT))
- [Xposed Bridge](https://github.com/rovo89/XposedBridge) (Licensed under
the [Apache License v2.0](http://opensource.org/licenses/Apache-2.0))
- [LibNFC-NCI](https://android.googlesource.com/platform/external/libnfc-nci/) (Licensed under
the [Apache License v2.0](http://opensource.org/licenses/Apache-2.0))
- [Protobuf](https://github.com/protocolbuffers/protobuf) (Licensed under the
modified [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause))
- [Android About Page](https://github.com/medyo/android-about-page) (Licensed under
the [MIT License](https://opensource.org/licenses/MIT))
- [Android Device Names](https://github.com/jaredrummler/AndroidDeviceNames) (Licensed under
the [Apache License v2.0](http://opensource.org/licenses/Apache-2.0))
- [Android Support library - preference v7 bugfix](https://github.com/Gericop/Android-Support-Preference-V7-Fix) (
Released into the public domain and partly licensed under
the [Apache License v2.0](http://opensource.org/licenses/Apache-2.0))
- [Android Room](https://developer.android.com/topic/libraries/architecture/room) (Licensed under
the [Apache License v2.0](http://opensource.org/licenses/Apache-2.0))
- [Android Lifecycle](https://developer.android.com/topic/libraries/architecture/lifecycle) (
Licensed under the [Apache License v2.0](http://opensource.org/licenses/Apache-2.0))
## Credits
- [ADBI](https://github.com/crmulliner/adbi): ARM and THUMB inline hooking
", Assign "at most 3 tags" to the expected json: {"id":"11572","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"