Watch Scripts

From Hack Wars Wiki

(Redirected from Watches)
Jump to: navigation, search
This Article is Incomplete
This article is apparently incomplete. You can help the HackWars wiki by expanding it


The basics of watches, and setting up a watch are covered in the second video tutorial.

Contents

Introduction

When a player is not online their computer is still vulnerable to attack, watches can be used to create an automated defense system, and collect information about the hackers that are doing you wrong. Watches can also be used to provide additional feedback about the state of your computer. Watches can currently be configured to observe three main events:

  • when you're scanned
  • change in the amount of money in your petty cash
  • and changes in the health of a port being watched.

Gaining Watch Experience

Every time one of your watches fire, you gain Watch experience. Another way is by compiling watch scripts.

Types of Watches

There are 3 types of watches: Scan, Health, and Petty Cash.

Scan Watches

Scan watches trigger when another player scans your system.

Potential Uses

These can be used to:

  • automatically turn off your systems ports when they are scanned, to confuse the potential attacker.
  • launch preemptive measures against one’s enemies: eg/ you might attack the Default Bank of someone who has scanned your system.
  • log events that happen while you're offline

Health Watches

Health watches trigger when the chosen port's health drops below a specified threshold.

Potential Uses

These can be used to:

  • counter-attack (above watch level 50)
  • heal ports
  • turn ports on/off
  • switch powerful defenses (firewalls) between an array of ports
  • log events that happen while you're offline

Petty Cash Watches

Petty Cash watches trigger when your petty cash reaches/exceeds a specified level. They are set to watch a specific bank port, which must be ON to have the watch fire.

Potential Uses

These can be used to:

  • at high levels, you can automatically deposit your cash into your bank when it reaches the specified amount; this is so valuable for a merchant
  • use to keep track of money, so you know you had that money but maybe got hacked.

Getting Watches

You can create your own watches using Hackscript, find them in NPC FTP ports, or buy watches from the Game Store or other players.

Installing and Configuring Watches

A Watch is installed from within the Watch Manager(System—>Watch Manager) by clicking “File—>Install New Watch”. At installation, you must specify the Type of Watch to be installed, as well as its Observed Port. Both the ports and the type can be changed after the installation.

Parameters

Watches are managed from within the Watch Manager(System—>Watch Manager). Here you can install Watches and vary their parameters by right clicking on an installed Watch under Type.

Like ports, a Watch can be turned On and Off and has an associated CPU cost, and there is an option to make a note concerning a Watch.

  • "Port" is the port which fires the watch.
  • "Type" sets the type of the watch and so sets the reason why a watch fires.
  • "Note" helps keeping an overview of what watches you have.
  • "Search Firewall" sets the result the function getSearchFireWall() will return in the watch script.
  • "Value"

On the right are the values specifying when the watch fires. A Health Watch fires when the health of the watched port drops below that value. A Petty Watch fires when the amount in your petty gets more as the value. A Scan Watch has no use for that value.

Some functions, like searchFirewall, allow a user to switch their firewall between ports to maximize their defense, this is done through setting the Observed Ports.

Anatomy of a Watch Script

Watch programs have one main entry point: Fire.

Fire: This function is called when the money in a player’s petty cash reaches a certain amount, or when a port’s hit-points go below a certain value.

note: When you have multiple watch scripts that fire at the same moment, it will be counted as a single fire action.

Examples

Scan watch example

logMessage("Scanned by " + getTargetIP());


Simple health watch example #1

This example is a Watch that both sends you a message (if you are online) and logs a message (if you are offline), informing you of an attack on your port. The message provides you with the attacker’s IP and what port they are attacking.

In fire:

logMessage(printf("%s attacked your port %s",getTargetIP(),getPort()));
message(getSourceIP(),printf("%s attacked your port %s",getTargetIP(),getPort()));


Simple health watch example #2

logMessage("Port #" + getPort() + " was attack by " + getTargetIP());


If you were attacked, this watch could put this into your log: (4:04:09 PM) Port #3 was attacked by 123.456.7.890 When you have installed the watch, make sure you set the health value to 99!

Advanced health watch example

string attacker = getTargetIP();
int port = getPort();
logMessage(attacker+ " attacked port " +port);
message(attacker,"You stand no chance against my defenses!");
counterattack(port);
switchAnyFireWall();


This script will notify you, launch a counterattack and move a firewall infront of the port. Make sure you set the observed port to an active attack port when installed.

Petty Cash watch example

logMessage("Petty Cash at watch level.");
Personal tools