-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4ecf6a
commit eda3cce
Showing
13 changed files
with
500 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <iostream> | ||
#include <curl/curl.h> | ||
|
||
void sendSms(const std::string& apiKey, const std::string& mobile, const std::string& message) { | ||
CURL* curl; | ||
CURLcode res; | ||
|
||
std::string url = "https://sms.anbuinfosec.xyz/api/sms?apikey=" + apiKey + | ||
"&mobile=" + mobile + "&msg=" + curl_easy_escape(curl, message.c_str(), message.length()); | ||
|
||
curl = curl_easy_init(); | ||
if (curl) { | ||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); | ||
curl_easy_setopt(curl, CURLOPT_RETURNTRANSFER, 1L); | ||
|
||
std::string response; | ||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL); | ||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); | ||
|
||
res = curl_easy_perform(curl); | ||
if (res != CURLE_OK) { | ||
std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl; | ||
} else { | ||
std::cout << response << std::endl; | ||
} | ||
curl_easy_cleanup(curl); | ||
} | ||
} | ||
|
||
int main() { | ||
std::string apiKey = "YOUR_API_KEY"; // Replace with your actual API key | ||
std::string mobile, message; | ||
|
||
std::cout << "Enter the mobile number (format: 01XXXXXXXXX): "; | ||
std::cin >> mobile; | ||
std::cin.ignore(); | ||
std::cout << "Enter the message to send: "; | ||
std::getline(std::cin, message); | ||
|
||
sendSms(apiKey, mobile, message); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
|
||
class Program | ||
{ | ||
private static readonly HttpClient client = new HttpClient(); | ||
|
||
static async Task Main() | ||
{ | ||
string apiKey = "YOUR_API_KEY"; // Replace with your actual API key | ||
string mobile = Prompt("Enter the mobile number (format: 01XXXXXXXXX): "); | ||
string message = Prompt("Enter the message to send: "); | ||
|
||
await SendSms(apiKey, mobile, message); | ||
} | ||
|
||
static async Task SendSms(string apiKey, string mobile, string message) | ||
{ | ||
string url = $"https://sms.anbuinfosec.xyz/api/sms?apikey={apiKey}&mobile={mobile}&msg={Uri.EscapeDataString(message)}"; | ||
|
||
HttpResponseMessage response = await client.GetAsync(url); | ||
string result = await response.Content.ReadAsStringAsync(); | ||
|
||
dynamic responseData = Newtonsoft.Json.JsonConvert.DeserializeObject(result); | ||
|
||
if (responseData.success == true) | ||
{ | ||
Console.WriteLine($"Success: {responseData.message}"); | ||
Console.WriteLine($"SMS sent to: {responseData.mobile}"); | ||
Console.WriteLine($"Message: {responseData.msg}"); | ||
Console.WriteLine($"New Balance: {responseData.newBalance}"); | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"Error: {responseData.message}"); | ||
} | ||
} | ||
|
||
static string Prompt(string message) | ||
{ | ||
Console.Write(message); | ||
return Console.ReadLine(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"net/http" | ||
"net/url" | ||
"os" | ||
) | ||
|
||
type Response struct { | ||
Success bool `json:"success"` | ||
Message string `json:"message"` | ||
Mobile string `json:"mobile"` | ||
Msg string `json:"msg"` | ||
NewBalance int `json:"newBalance"` | ||
} | ||
|
||
func main() { | ||
var apiKey, mobile, message string | ||
|
||
fmt.Print("Enter your API key: ") | ||
fmt.Scanln(&apiKey) | ||
fmt.Print("Enter the mobile number (format: 01XXXXXXXXX): ") | ||
fmt.Scanln(&mobile) | ||
fmt.Print("Enter the message to send: ") | ||
fmt.Scanln(&message) | ||
|
||
sendSms(apiKey, mobile, message) | ||
} | ||
|
||
func sendSms(apiKey, mobile, message string) { | ||
baseURL := "https://sms.anbuinfosec.xyz/api/sms" | ||
params := url.Values{} | ||
params.Add("apikey", apiKey) | ||
params.Add("mobile", mobile) | ||
params.Add("msg", message) | ||
|
||
resp, err := http.Get(fmt.Sprintf("%s?%s", baseURL, params.Encode())) | ||
if err != nil { | ||
fmt.Println("Error:", err) | ||
return | ||
} | ||
defer resp.Body.Close() | ||
|
||
var response Response | ||
if err := json.NewDecoder(resp.Body).Decode(&response); err != nil { | ||
fmt.Println("Error decoding response:", err) | ||
return | ||
} | ||
|
||
if response.Success { | ||
fmt.Printf("Success: %s\nSMS sent to: %s\nMessage: %s\nNew Balance: %d\n", response.Message, response.Mobile, response.Msg, response.NewBalance) | ||
} else { | ||
fmt.Printf("Error: %s\n", response.Message) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import java.io.BufferedReader; | ||
import java.io.InputStreamReader; | ||
import java.net.HttpURLConnection; | ||
import java.net.URL; | ||
import java.net.URLEncoder; | ||
|
||
public class SendSms { | ||
public static void main(String[] args) { | ||
try { | ||
System.out.print("Enter your API key: "); | ||
String apiKey = new BufferedReader(new InputStreamReader(System.in)).readLine(); | ||
System.out.print("Enter the mobile number (format: 01XXXXXXXXX): "); | ||
String mobile = new BufferedReader(new InputStreamReader(System.in)).readLine(); | ||
System.out.print("Enter the message to send: "); | ||
String message = new BufferedReader(new InputStreamReader(System.in)).readLine(); | ||
|
||
sendSms(apiKey, mobile, message); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private static void sendSms(String apiKey, String mobile, String message) { | ||
try { | ||
String urlString = "https://sms.anbuinfosec.xyz/api/sms?apikey=" + apiKey + | ||
"&mobile=" + mobile + "&msg=" + URLEncoder.encode(message, "UTF-8"); | ||
|
||
URL url = new URL(urlString); | ||
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | ||
conn.setRequestMethod("GET"); | ||
|
||
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); | ||
StringBuilder content = new StringBuilder(); | ||
String inputLine; | ||
while ((inputLine = in.readLine()) != null) { | ||
content.append(inputLine); | ||
} | ||
in.close(); | ||
|
||
String response = content.toString(); | ||
System.out.println(response); // You can parse the JSON response here for success/error handling | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const axios = require('axios'); | ||
|
||
async function sendSms(apiKey, mobile, message) { | ||
const url = 'https://sms.anbuinfosec.xyz/api/sms'; | ||
|
||
try { | ||
const response = await axios.get(url, { | ||
params: { | ||
apikey: apiKey, | ||
mobile: mobile, | ||
msg: message | ||
} | ||
}); | ||
|
||
if (response.data.success) { | ||
console.log(`Success: ${response.data.message}`); | ||
console.log(`SMS sent to: ${response.data.mobile}`); | ||
console.log(`Message: ${response.data.msg}`); | ||
console.log(`New Balance: ${response.data.newBalance}`); | ||
} else { | ||
console.log(`Error: ${response.data.message}`); | ||
} | ||
} catch (error) { | ||
console.error(`An error occurred: ${error.message}`); | ||
} | ||
} | ||
|
||
const apiKey = "YOUR_API_KEY"; // Replace with your actual API key | ||
const mobile = prompt("Enter the mobile number (format: 01XXXXXXXXX): "); | ||
const message = prompt("Enter the message to send: "); | ||
|
||
sendSms(apiKey, mobile, message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import io.ktor.client.* | ||
import io.ktor.client.request.* | ||
import io.ktor.client.statement.* | ||
|
||
suspend fun sendSms(apiKey: String, mobile: String, message: String) { | ||
val client = HttpClient() | ||
|
||
try { | ||
val response: HttpResponse = client.get("https://sms.anbuinfosec.xyz/api/sms") { | ||
parameter("apikey", apiKey) | ||
parameter("mobile", mobile) | ||
parameter("msg", message) | ||
} | ||
|
||
val responseData = response.readText() | ||
println(responseData) // You may want to parse JSON here for success/error handling | ||
|
||
} catch (e: Exception) { | ||
println("An error occurred: ${e.message}") | ||
} finally { | ||
client.close() | ||
} | ||
} | ||
|
||
fun main() { | ||
val apiKey = "YOUR_API_KEY" // Replace with your actual API key | ||
println("Enter the mobile number (format: 01XXXXXXXXX): ") | ||
val mobile = readLine()!! | ||
println("Enter the message to send: ") | ||
val message = readLine()!! | ||
|
||
// Call the suspend function in a coroutine | ||
kotlinx.coroutines.runBlocking { | ||
sendSms(apiKey, mobile, message) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
function sendSms($apiKey, $mobile, $message) { | ||
$url = "https://sms.anbuinfosec.xyz/api/sms?apikey=$apiKey&mobile=$mobile&msg=$message"; | ||
|
||
$response = file_get_contents($url); | ||
$responseData = json_decode($response, true); | ||
|
||
if ($responseData['success']) { | ||
echo "Success: " . $responseData['message'] . PHP_EOL; | ||
echo "SMS sent to: " . $responseData['mobile'] . PHP_EOL; | ||
echo "Message: " . $responseData['msg'] . PHP_EOL; | ||
echo "New Balance: " . $responseData['newBalance'] . PHP_EOL; | ||
} else { | ||
echo "Error: " . $responseData['message'] . PHP_EOL; | ||
} | ||
} | ||
|
||
$apiKey = "YOUR_API_KEY"; // Replace with your actual API key | ||
$mobile = readline("Enter the mobile number (format: 01XXXXXXXXX): "); | ||
$message = readline("Enter the message to send: "); | ||
|
||
sendSms($apiKey, $mobile, $message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import requests | ||
|
||
def send_sms(api_key, mobile, message): | ||
url = "https://sms.anbuinfosec.xyz/api/sms" | ||
params = { | ||
"apikey": api_key, | ||
"mobile": mobile, | ||
"msg": message | ||
} | ||
|
||
try: | ||
response = requests.get(url, params=params) | ||
response_data = response.json() | ||
|
||
if response_data.get("success"): | ||
print(f"Success: {response_data['message']}") | ||
print(f"SMS sent to: {response_data['mobile']}") | ||
print(f"Message: {response_data['msg']}") | ||
print(f"New Balance: {response_data['newBalance']}") | ||
else: | ||
print(f"Error: {response_data['message']}") | ||
|
||
except Exception as e: | ||
print(f"An error occurred: {e}") | ||
|
||
if __name__ == "__main__": | ||
api_key = "YOUR_API_KEY" # Replace with your actual API key | ||
mobile = input("[?] Enter the mobile number (format: 01XXXXXXXXX): ") | ||
message = input("[?] Enter the message to send: ") | ||
send_sms(api_key, mobile, message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use reqwest; | ||
use std::collections::HashMap; | ||
use std::io; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let api_key = "YOUR_API_KEY"; // Replace with your actual API key | ||
|
||
let mut mobile = String::new(); | ||
let mut message = String::new(); | ||
|
||
println!("Enter the mobile number (format: 01XXXXXXXXX): "); | ||
io::stdin().read_line(&mut mobile).unwrap(); | ||
mobile = mobile.trim().to_string(); | ||
|
||
println!("Enter the message to send: "); | ||
io::stdin().read_line(&mut message).unwrap(); | ||
message = message.trim().to_string(); | ||
|
||
send_sms(api_key, &mobile, &message).await; | ||
} | ||
|
||
async fn send_sms(api_key: &str, mobile: &str, message: &str) { | ||
let url = "https://sms.anbuinfosec.xyz/api/sms"; | ||
let params = HashMap::from([ | ||
("apikey", api_key), | ||
("mobile", mobile), | ||
("msg", message), | ||
]); | ||
|
||
let client = reqwest::Client::new(); | ||
let res = client.get(url).query(¶ms).send().await.unwrap(); | ||
|
||
let response_data: serde_json::Value = res.json().await.unwrap(); | ||
|
||
if response_data["success"].as_bool().unwrap() { | ||
println!("Success: {}", response_data["message"]); | ||
println!("SMS sent to: {}", response_data["mobile"]); | ||
println!("Message: {}", response_data["msg"]); | ||
println!("New Balance: {}", response_data["newBalance"]); | ||
} else { | ||
println!("Error: {}", response_data["message"]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require 'net/http' | ||
require 'uri' | ||
require 'json' | ||
|
||
def send_sms(api_key, mobile, message) | ||
uri = URI.parse("https://sms.anbuinfosec.xyz/api/sms") | ||
params = { | ||
apikey: api_key, | ||
mobile: mobile, | ||
msg: message | ||
} | ||
uri.query = URI.encode_www_form(params) | ||
|
||
response = Net::HTTP.get_response(uri) | ||
response_data = JSON.parse(response.body) | ||
|
||
if response_data['success'] | ||
puts "Success: #{response_data['message']}" | ||
puts "SMS sent to: #{response_data['mobile']}" | ||
puts "Message: #{response_data['msg']}" | ||
puts "New Balance: #{response_data['newBalance']}" | ||
else | ||
puts "Error: #{response_data['message']}" | ||
end | ||
end | ||
|
||
print "Enter your API key: " | ||
api_key = gets.chomp | ||
print "Enter the mobile number (format: 01XXXXXXXXX): " | ||
mobile = gets.chomp | ||
print "Enter the message to send: " | ||
message = gets.chomp | ||
|
||
send_sms(api_key, mobile, message) |
Oops, something went wrong.