dank / tarkov Goto Github PK
View Code? Open in Web Editor NEWA Rust library for the Escape from Tarkov API
License: MIT License
A Rust library for the Escape from Tarkov API
License: MIT License
Hi i wondering will this stiill interact with the api i have attempted sniffing the game itself but it uses updated tls encryption now. Does this library still work?
No need to constantly duplicate the match res.error_code
snippet.
just wondering if you've encountered this error from RagFairBuyOffer?
{
error: {
err: 228,
errmsg: '228 - ItemsMoving: profile [my pmc's profile id here] is locked',
data: []
}
}
You added an error 228 from f3f3190 and I was wondering if it's the same error and you added a more descriptive reason.
note: not using your library (reimplemented it in TS). logged back into the game and everything functions normally.
Not work now, but game and launcher versions are replaced on more newer. I think the problem on version of unity
I think the owners need to create some build funcs to set a game and launcher versions. Should check, but i don't know how.
Hi again, is there a way to fetch all flea market pages at the same time, or choose how many offers there are per page?
Finally I've grab token+hardware id from EFT Launcher.
Now, when I'm trying to auth with this I'm getting "UnknownAPIError(232)".
I used "from_access_token" from "auth_basic" example
Looks like developer changed api?
I'm getting this error whenever I try to buy items from the flea market
Error: Json(Error("invalid type: integer `6932509`, expected a string", line: 1, column: 91))
I'm thinking maybe an endpoint has changed? I'm not too sure, I've been messing with it for a few hours and haven't been able to figure out whats wrong.
This happens when following the flea market buying example.
I'm sorry to make this question because I know it's probably a really easy fix but I can't figure out what it means. I've never used rust before. Why am I getting these errors when I run the 'test-api.rs' file? and will this actually affect me at all, or should I ignore it and begin to use the api otherwise...
thanks
Unfortunate timing but actix_web
is dead. Not sure what the best alternative is yet but it should be updated. Maybe hyper.rs
Use #[serde(flatten)]
with ErrorResponse
instead
How "safe" would you assume this is, I know BSG hates people doing stuff that they don't enjoy. Would it be considered moderately safe if you're of course so spamming the buy and sell on ragfair?
Hey, I'm trying to authenticate using login_with_2fa, but keep running into
Error: LoginError(BadTwoFactorCode).
I've added io:stdin().read_line so that I can input the 2FA manually.
I'm unable to figure out why this fails.. Do you have any suggestions?
Sorry if an issue isn't the the best place to ask this, but Google hasn't been kind to me on this one..
main.rs:
use tarkov::auth::LoginError;
use tarkov::hwid::generate_hwid;
use tarkov::{Error, Tarkov};
use std::io;
#[tokio::main]
async fn main() -> Result<(), Error> {
std::env::set_var("RUST_LOG", "tarkov=info");
let email = "<email>";
let password = "<pw>";
let hwid = generate_hwid();
let t = match Tarkov::login(email, password, &hwid).await {
Ok(t) => Ok(t),
Err(Error::LoginError(e)) => match e {
// 2FA required!
LoginError::TwoFactorRequired => {
// Get 2FA from email (or generate TOTP) then continue...
let mut code = String::new();
println!("Hardware ID: {}", &hwid);
println!("Input 2FA:");
io::stdin().read_line(&mut code).expect("Failed to read input");
println!("{}", &code);
Tarkov::login_with_2fa(email, password, &code, &hwid).await
}
_ => Err(e)?,
},
Err(e) => Err(e),
}?;
println!("{}", t.session);
Ok(())
}
Cargo.toml:
[package]
name = "eft_market"
description = "Idk yet"
version = "0.1.0"
authors = ["Dan Kyung <[email protected]>"]
edition = "2018"
[dependencies]
md5 = "0.7"
err-derive = "0.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
flate2 = { version = "1.0", features = ["zlib"], default-features = false }
rand = "0.7"
log = "0.4"
serde_repr = "0.1"
hyper = "0.13"
hyper-tls = "0.4"
http = "0.2"
tarkov = { path = "./tarkov-master" }
tokio = { version = "0.2.6", features = ["full"] }
rustc version: 1.41.0
Hi,
is there a way to get the money a Trader wants to give me for a specific item?
Thanks!
I created a new project to use this library. I set a new dependency in cargo.toml
as tarkov = "0.1"
and then in my main.rs
file I only have a basic println function.
When I run this, no matter what I put in that file, it will work fine without the tarkov dependency but break as soon as I put it back. I get back this error:
C:/Users/Aiden/.cargo/bin/cargo.exe run --color=always --package tarkovbot --bin tarkovbot
Compiling err-derive v0.2.2
error[E0433]: failed to resolve: could not find `__rt` in `quote`
--> C:\Users\Aiden\.cargo\registry\src\github.com-1ecc6299db9ec823\err-derive-0.2.2\src\lib.rs:203:56
|
203 | fn display_body(s: &synstructure::Structure) -> quote::__rt::TokenStream {
| ^^^^ could not find `__rt` in `quote`
error: aborting due to previous error
Hi, can you briefly describe the procedure for writing an unofficial API, please? Did you sniff and decrypt packets or decompile the game to see what requests were being sent?
I'm new and would really like to know this, thx)
Installed everything on WSL, cargo build executes no problem, running rustc auth_basic.rs throws
error[E0670]: async fn
is not permitted in the 2015 edition
--> auth_basic.rs:5:1
|
5 | async fn main() -> Result<(), Error> {
| ^^^^^
error[E0433]: failed to resolve: maybe a missing crate tarkov
?
--> auth_basic.rs:1:5
|
1 | use tarkov::hwid::generate_hwid;
| ^^^^^^ maybe a missing crate tarkov
?
error[E0432]: unresolved import tarkov
--> auth_basic.rs:2:5
|
2 | use tarkov::{Error, Tarkov};
| ^^^^^^ maybe a missing crate tarkov
?
error[E0433]: failed to resolve: use of undeclared type or module actix_rt
--> auth_basic.rs:4:3
|
4 | #[actix_rt::main]
| ^^^^^^^^ use of undeclared type or module actix_rt
error[E0433]: failed to resolve: use of undeclared type or module env_logger
--> auth_basic.rs:7:5
|
7 | env_logger::init();
| ^^^^^^^^^^ use of undeclared type or module env_logger
error[E0425]: cannot find function generate_hwid
in this scope
--> auth_basic.rs:9:57
|
9 | let t = Tarkov::login("[email protected]", "password", generate_hwid().as_str()).await?;
| ^^^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find function generate_hwid
in this scope
--> auth_basic.rs:14:9
|
14 | generate_hwid().as_str(),
| ^^^^^^^^^^^^^ not found in this scope
error[E0277]: main
has invalid return type impl std::future::Future
--> auth_basic.rs:5:20
|
5 | async fn main() -> Result<(), Error> {
| ^^^^^^^^^^^^^^^^^ main
can only return types that implement std::process::Termination
|
= help: consider using ()
, or a Result
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0277, E0425, E0432, E0433, E0670.
For more information about an error, try rustc --explain E0277
.
It seems that you reply really fast, my apologies for yet another issue.
What would be the best way to automatically receive all items from a trader?
what is the best way to sniff the PHPSESSID
cookie. idk how to find it. I tried wireshark but with no success.
I'm sorry if this annoys you.
Log debug stuff behind flag, especially raw json data
Hey,
Browsed the code, and even though I do not use Rust, it's super clean! Do you plan on adding a way to inspect the mods and attachment for a weapon (or generally any item) ?
It would seem that this line covers it in your Item
struct but the Upd
struct does not seem to reflect that
Thanks !
So I have a pub extern function that uses #[no_mangle]
This pub function calls an async function that attempts to call get_items(), but when get_items() is used cargo build just hangs, no matter how long I leave it for.
Changing this call to any other call (like get_item_prices()) or getting rid of #[no_mangle] on the pub function fixes the issue.
Is there a reason for this happening that I'm not aware of?
EFT devs are very inconsistent with their JSON outputs, therefore I was forced to comment a few invalid or unknown fields.
Hi Dan. Could you please answer, will this project develop further after "certficate pinning" added to EFT?
Are there any ways to continue research API?
First off, thank you so much for replying to these issues.
I want to write the items result to a file. I try doing this with serde, however it doesn't seem like it is particularly fond of tarkov::constant::Item .
Is there a way around this?
Full error message:
error[E0277]: the trait bound `tarkov::constant::Item: serde::ser::Serialize` is not satisfied
--> src\main.rs:61:36
|
61 | serde_json::to_writer(file_items, &items)?;
| ^^^^^^ the trait `serde::ser::Serialize` is not implemented for `tarkov::constant::Item`
|
::: C:\Users\einarw\.cargo\registry\src\github.com-1ecc6299db9ec823\serde_json-1.0.46\src\ser.rs:2167:8
|
2167 | T: Serialize,
| --------- required by this bound in `serde_json::ser::to_writer`
|
= note: required because of the requirements on the impl of `serde::ser::Serialize` for `std::collections::HashMap<std::string::String, tarkov::constant::Item>`
Cargo version
1.41.0
Cargo.toml
[package]
name = "test_package"
version = "0.1.0"
authors = ["me"]
edition = "2018"
[dependencies]
serde_json = "1.0"
tarkov = "0.1.1"
tokio = { version = "0.2", features = ["macros"] }
Main.rs
use tarkov::auth::LoginError;
use tarkov::hwid::generate_hwid;
use tarkov::{Error, Tarkov};
use std::io;
//use std::time::{SystemTime, UNIX_EPOCH};
//use tarkov::market_filter::{Currency, MarketFilter, Owner};
use tarkov::profile::Side;
use std::fs::File;
use serde_json;
#[tokio::main]
async fn main() -> Result<(), Error> {
std::env::set_var("RUST_LOG", "tarkov=info");
let email = "<email@email>";
let password = "<pw>;
let hwid = "<hwid>";
// Create a new hwid, will require 2fa
//let hwid = generate_hwid();
//let mut file_hwid = File::create("hwid.txt")?;
//let byte_hwid = hwid.as_bytes();
//file_hwid.write_all(byte_hwid)?;
let t = match Tarkov::login(email, password, &hwid).await {
Ok(t) => Ok(t),
Err(Error::LoginError(e)) => match e {
// 2FA required!
LoginError::TwoFactorRequired => {
// Get 2FA from email (or generate TOTP) then continue...
let mut code = String::new();
println!("Input 2FA:");
io::stdin().read_line(&mut code).expect("Failed to read input");
let len = code.trim_end_matches(&['\r', '\n'][..]).len();
code.truncate(len);
println!("{}", &code);
Tarkov::login_with_2fa(email, password, &code, &hwid).await
}
_ => Err(e)?,
},
Err(e) => Err(e),
}?;
println!("{}", t.session);
let sess = Tarkov::from_session(&t.session);
// Find and select PMC profile to complete login.
let profiles = sess.get_profiles().await?;
let profile = profiles
.into_iter()
.find(|p| p.info.side != Side::Savage)
.unwrap();
sess.select_profile(&profile.id).await?;
// Fetch the translation table for market categories.
let locale = sess.get_i18n("en").await?;
// Fetch items and write to file
let items = sess.get_items().await?;
let file_items = File::create("items.txt")?;
serde_json::to_writer(file_items, &items)?;
Ok(())
}
How to get own offers list? In game we have separate tab with own offers, so looks like we can add some parameter to our filter in search request?
I can't auth. I've tried to sniffing traffic from EFT client, but it's HTTPS with cerificate verification. When I'm trying to use Charles for example - I got error in EFT client (Certificate invalid).
.
EFT devs are bad at using JSON properly and sometimes the data
type may differ a lot
[2020-01-21T00:02:06Z DEBUG tarkov::auth] Response: {"err":214,"errmsg":"214 - Enter captcha","data":{"captchaRequired":true}}
Error: Json(Error("missing field `aid`", line: 1, column: 73))
Fix this by not deserializing data
unless err
is 0.
Sorry for perseverance. Few days I'm trying to grab this session from EFT launcher.
Do you have any tips, how to grab it? Please, it's very important.
Thank you.
I got this error when try to launch example of auth_basic.
Error: SendRequestError(Connect(Resolver(ResolveError { inner: ProtoError { inner: No connections available } proto error })))
I'm mostly wondering what properties I'm supposed to provide to the Captcha Harvester linked on the README.
Just found this project, have been poking around it for a bit, what's the best way to count total roubles balance in a profile?
To prevent issues like #47 in the future.
Hello everyone!
In the current version of the game, I cannot get access to the flea marketplace until I reach 10 lvl.
I wondering is it possible to buy the standard game edition with 1 lvl character and use this tool to collect item prices on the flea market with 1 lvl game account? In this way, I am trying to prevent ban of my primary account.
There's a few types that can be converted to enums. Investigate further and use enums > strings.
let t = Tarkov::login("working email", "working password", "some generated hwid").await?;
println!("{}", t.session);
// Find and select PMC profile to complete login.
let profiles = t.get_profiles().await?;
results in
SOME SESSION ID (showing that it can log in)
Error: Json(Error("invalid type: floating point `1.15`, expected u64", line: 1, column: 436688))
Hey there, interested in reverse engineering more of the API and extending off of this repo but Iโm kind of a beginner in this realm, any pointers in how to get around the certificate pinning so I can sniff the in game traffic? How were you able to determine the in game endpoints and payloads to send (with the ragfair and market for example)
Hi!
I realy like this project.
when i try to run your example i get this message:
cargo run --example auth_2fa
Finished dev [unoptimized + debuginfo] target(s) in 0.14s
Running `target\debug\examples\auth_2fa.exe`
Error: SendRequestError(Connect(Io(Custom { kind: Other, error: "the handshake failed: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed:.\\ssl\\s3_clnt.c:1269:: unable to get local issuer certificate" })))
error: process didn't exit successfully: `target\debug\examples\auth_2fa.exe` (exit code: 1)```
Map more API error codes to enum values
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.