attack()
From Hack Wars Wiki
| Function information for attack() | |
| Function | attack(int player port number,string targetIP, int target port number) |
| API | Watch |
| Cost | $10,000 |
| Level | 50 |
| CPU Usage | 10 |
| Description | Launches an attack from the port indicated against the player and port provided. |
Limitations
This function only works if the watch was fired by triggerWatch(). If a watch using this function was fired by a scan or attack then attack() will be skipped.
Basic Example
Putting this in the 'fire' section of your watch would make this watch attack the IP and port that was sent to it by triggerWatch() using the attack port you specify.
int main() { // asuming that the triggerWatch() key-value pairs are: // attackport = attack port to use in the attack (ex. 0) // targetip = ip to be scanned (ex. "900.800.6.000" ) // targetport = port to attack (ex. 1) if (isTriggered()) { // only allows this to part run if the watch was triggered by triggerWatch() // these 3 lines retrieve the values sent by triggerWatch() int attackport = getTriggerParameter("attackport"); // ex. int attackport = 0; string targetip = getTriggerParameter("targetip"); // ex. string targetip = "900.800.6.000"; int targetport = getTriggerParameter("targetport"); // ex. int targetport = 1; // this attack the targetip on targetport with the attack script on attackport attack(attackport,targetip,targetport); // ex. attack(0,"900.800.6.000",1); } else { // normal trigger script can go here } } |
