Skip to content

Commit

Permalink
add fake dev pair
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-ius committed Feb 18, 2024
1 parent 0e93cf1 commit 02af872
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 33 deletions.
2 changes: 1 addition & 1 deletion rws-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rws-cli"
version = "0.1.6"
version = "0.1.7"
edition = "2021"

[dependencies]
Expand Down
7 changes: 4 additions & 3 deletions rws-cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ struct Args {
fn main() {
let args = Args::parse();
let wclient = WClientBuilder::new()
.w_id(&args.device_id)
.random_mode()
.random_tp()
// .w_id(&args.device_id)
.random_id()
.random_key()
.random_dev()
.random_tz()
.build();

Expand Down
34 changes: 16 additions & 18 deletions rws/src/warp/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct WClientBuilder<'w> {
_id: Option<&'w str>,
_key: Option<&'w str>,
_model: Option<&'w str>,
_type: Option<&'w str>,
_key: Option<&'w str>,
_tos: Option<&'w str>,
_locale: Option<&'w str>,
}
Expand All @@ -15,40 +15,34 @@ impl<'w> WClientBuilder<'w> {
pub fn new() -> WClientBuilder<'w> {
Self {
_id: None,
_key: None,
_model: None,
_type: None,
_key: None,
_tos: None,
_locale: None,
}
}


pub fn w_id(mut self, _id: &'w str) -> Self {
self._id = Some(_id);
self
}

pub fn w_key(mut self, _key: &'w str) -> Self {
self._key = Some(_key);
self
}
pub fn w_model(mut self, _model: &'w str) -> Self {
self._model = Some(_model);
self
}

pub fn w_type(mut self, _type: &'w str) -> Self {
self._type = Some(_type);
self
}

pub fn w_key(mut self, _key: &'w str) -> Self {
self._key = Some(_key);
self
}

pub fn w_tos(mut self, _tos: &'w str) -> Self {
self._tos = Some(_tos);
self
}

pub fn w_locale(mut self, _locale: &'w str) -> Self {
self._locale = Some(_locale);
self
Expand All @@ -57,22 +51,26 @@ impl<'w> WClientBuilder<'w> {
pub fn build(self) -> WClientBuilder<'w> {
WClientBuilder {
_id: Some(self._id.unwrap_or("default_id")),
_key: Some(self._key.unwrap_or("default_key")),
_model: Some(self._model.unwrap_or("default_model")),
_type: Some(self._type.unwrap_or("default_type")),
_key: Some(self._key.unwrap_or("default_key")),
_tos: Some(self._tos.unwrap_or("default_tos")),
_locale: Some(self._locale.unwrap_or("default_locale")),
}
}

pub fn random_mode(self) -> Self {
self.w_model(random::md::sample())
pub fn random_id(self) -> Self {
self.w_id(random::fake::take(22, |_c| true))
}

pub fn random_tp(self) -> Self {
self.w_type(random::tp::sample())
pub fn random_key(self) -> Self {
self.w_key(random::fake::take(43, |_c| true))
}

pub fn random_dev(self) -> Self {
let (t, z) = random::dev::sample();
self.w_model(t)
.w_type(z)
}
pub fn random_tz(self) -> Self {
let (t, z) = random::tz::sample();
self.w_tos(t)
Expand Down
174 changes: 174 additions & 0 deletions rws/src/warp/random/dev.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
use rand::Rng as _;

pub fn sample()-> (&'static str, &'static str){
let dev_pool = vec![
("iPhone15,1", "iOS"),
("iPhone15,2", "iOS"),
("iPhone15,3", "iOS"),
("iPhone15,4", "iOS"),
("iPhone14,1", "iOS"),
("iPhone14,2", "iOS"),
("iPhone14,3", "iOS"),
("iPhone14,4", "iOS"),
("iPhone13,3", "iOS"),
("iPhone12,1", "iOS"),
("iPhone11,2", "iOS"),
("iPhone10,6", "iOS"),
("iPhone10,3", "iOS"),
("iPhone9,2", "iOS"),
("iPhone8,2", "iOS"),
("iPhone8,1", "iOS"),
("iPhone7,1", "iOS"),
("iPhone7,2", "iOS"),
("iPhone6,1", "iOS"),
("iPhone6,2", "iOS"),
("iPhone5,1", "iOS"),
("iPhone5,2", "iOS"),
("iPhone5,3", "iOS"),
("iPhone5,4", "iOS"),
("iPad9,1", "iPadOS"),
("iPad9,2", "iPadOS"),
("iPad13,1", "iPadOS"),
("iPad13,2", "iPadOS"),
("iPad13,4", "iPadOS"),
("iPad13,5", "iPadOS"),
("iPad13,6", "iPadOS"),
("iPad13,7", "iPadOS"),
("iPad13,8", "iPadOS"),
("iPad13,9", "iPadOS"),
("iPad13,10", "iPadOS"),
("iPad13,11", "iPadOS"),
("iPad14,1", "iPadOS"),
("iPad14,2", "iPadOS"),
("Watch5,1", "watchOS"),
("Watch5,2", "watchOS"),
("Watch5,3", "watchOS"),
("Watch5,4", "watchOS"),
("Watch5,9", "watchOS"),
("Watch5,10", "watchOS"),
("Watch5,11", "watchOS"),
("Watch5,12", "watchOS"),
("Watch6,1", "watchOS"),
("Watch6,2", "watchOS"),
("Watch6,3", "watchOS"),
("Watch6,4", "watchOS"),
("Watch6,6", "watchOS"),
("Watch6,7", "watchOS"),
("AirPods1,1", "Firmware"),
("AirPods2,1", "Firmware"),
("AirPods8,1", "Firmware"),
("AirPods1,2", "Firmware"),
("AppleTV5,3", "tvOS"),
("AppleTV6,2", "tvOS"),
("AppleTV11,1", "tvOS"),
("AudioAccessory1,1", "audioOS"),
("AudioAccessory1,2", "audioOS"),
("AudioAccessory5,1", "audioOS"),
("MacBookAir10,1", "macOS"),
("MacBookAir9,1", "macOS"),
("MacBookPro16,1", "macOS"),
("MacBookPro16,2", "macOS"),
("MacBookPro16,3", "macOS"),
("MacBookPro16,4", "macOS"),
("MacBookPro17,1", "macOS"),
("MacBookPro18,1", "macOS"),
("MacBookPro18,2", "macOS"),
("MacBookPro18,3", "macOS"),
("MacBookPro18,4", "macOS"),
("iMac20,1", "macOS"),
("iMac20,2", "macOS"),
("iMac21,1", "macOS"),
("iMac21,2", "macOS"),
("Macmini9,1", "macOS"),
("MacPro7,1", "macOS"),
("MacStudio1,1", "macOS"),
("MacStudio1,2", "macOS"),
("GeForce RTX 3090", "Windows"),
("GeForce RTX 3080", "Ubuntu"),
("GeForce RTX 3070", "Fedora"),
("AMD Radeon RX 7900 XTX", "Windows"),
("AMD Radeon RX 7900 XT", "Manjaro"),
("Kintex 7 FPGAs", "CentOS"),
("Kintex UltraScale FPGA", "RedHat"),
("SHIELD Android TV", "Android"),
("SM-G991B", "Android 11"),
("SM-G996B", "Android 11"),
("SM-G998B", "Android 11"),
("G991A", "Android 12"),
("G996B", "Android 12"),
("ELE-L29", "Android 9"),
("VOG-L29", "Android 9"),
("IN2013", "Android 11"),
("KB2003", "Android 11"),
("M2007J3SG", "Android 10"),
("GeForce RTX 3090", "Windows"),
("GeForce RTX 3080", "Windows"),
("GeForce RTX 3070", "Windows"),
("GeForce RTX 3060 Ti", "Windows"),
("GeForce RTX 3060", "Windows"),
("GeForce RTX 2080 Ti", "Windows"),
("GeForce RTX 2080", "Windows"),
("GeForce RTX 2070", "Windows"),
("GeForce RTX 2060", "Windows"),
("GeForce GTX 1660 Ti", "Windows"),
("GeForce GTX 1660", "Windows"),
("GeForce GTX 1650", "Windows"),
("GeForce GTX 1080 Ti", "Windows"),
("GeForce GTX 1080", "Windows"),
("GeForce GTX 1070", "Windows"),
("GeForce GTX 1060", "Windows"),
("GeForce GTX 1050 Ti", "Windows"),
("GeForce GTX 1050", "Windows"),
("Quadro RTX 8000", "Windows"),
("Quadro RTX 6000", "Windows"),
("Quadro RTX 5000", "Windows"),
("Quadro P4000", "Windows"),
("Quadro P2000", "Windows"),
("Quadro P1000", "Windows"),
("A100-SXM4-40GB", "Linux"),
("A100-PCIE-40GB", "Linux"),
("DGX A100", "Linux"),
("DGX Station A100", "Linux"),
("DGX-1 V100 System", "Linux"),
("DGX-2", "Linux"),
("Quadro RTX 8000", "Linux"),
("Quadro RTX 6000", "Linux"),
("Mellanox ConnectX-6 Dx", "Linux"),
("Mellanox BlueField-2 DPU", "Linux"),
("Tesla V100-SXM2-32GB", "Linux"),
("Tesla P100-PCIE-16GB", "Linux"),
("NVIDIA H200", "Linux"),
("NVIDIA H100", "Linux"),
("AMD Radeon RX 7900 XTX", "Windows"),
("AMD Radeon RX 7900 XT", "Windows"),
("AMD Radeon RX 7800 XT", "Windows"),
("AMD Radeon RX 6800 XT", "Windows"),
("AMD Radeon RX 6750 XT", "Windows"),
("AMD Radeon RX 6600 XT", "Windows"),
("AMD Radeon RX 6500 XT", "Windows"),
("AMD Instinct MI250X", "Linux"),
("AMD Instinct MI250", "Linux"),
("AMD Instinct MI200", "Linux"),
("AMD Instinct MI100", "Linux"),
("Intel Arc A770", "Windows"),
("Intel Arc A370M", "Windows"),
("Intel Arc A350M", "Windows"),
("Intel Arc A770", "Windows"),
("Intel Arc A750", "Windows"),
("Intel Arc A380", "Windows"),
("Intel Arc Pro A40", "Windows"),
("Intel Arc Pro A50", "Windows"),
("Kintex 7 FPGAs", "Windows"),
("Kintex 7 FPGAs", "Ubuntu"),
("Kintex 7 FPGAs", "CentOS"),
("Kintex 7 FPGAs", "RedHat"),
("Kintex UltraScale FPGA", "Windows"),
("Kintex UltraScale FPGA", "Ubuntu"),
("Kintex UltraScale FPGA", "CentOS"),
("Kintex UltraScale FPGA", "RedHat")
];

let mut rng = rand::thread_rng();
let _idx = rng.gen_range(0..dev_pool.len());
dev_pool[_idx]
}
19 changes: 10 additions & 9 deletions rws/src/warp/random/fake.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rand::Rng as _;
use rand::distributions::Alphanumeric;

fn take<F>(dsize: usize, filter: F) -> String
pub fn take<F>(dsize: usize, filter: F) -> &'static str
where
F: FnMut(&char) -> bool,
{
Expand All @@ -10,14 +10,15 @@ where
.map(char::from)
.filter(filter)
.take(dsize)
.collect();
sample
.collect::<String>();
sample.leak()
}

pub fn sample() -> (String, String, String ) {
let _url_r = take(3, |c| c.is_ascii_digit());
let _install_r = take(43, |_c| true);
let _token_r = take(134, |_c| true);
// pub fn sample() -> (&'static str, &'static str, &'static str, &'static str) {
// let _url = take(3, |c| c.is_ascii_digit());
// let _ins = take(43, |_c| true);
// let _key = take(43, |_c| true);
// let _tk = take(134, |_c| true);

(_url_r, _install_r, _token_r)
}
// (_url.leak(), _ins.leak(), _key.leak() , _tk.leak())
// }
5 changes: 3 additions & 2 deletions rws/src/warp/random/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod fake;
pub mod tz;
pub mod tp;
pub mod md;
// pub mod tp;
// pub mod md;
pub mod dev;

0 comments on commit 02af872

Please sign in to comment.