Attacking

Introduction

One of your main Hack Wars skills is Attacking. Attacks can be performed on other players or NPCs. To use the Attack function, first do a Port Scan on an IP address to determine which ports your victim is using. The Port Scan window allows you to start an Attack directly after a scan. You gain attack experience equal to the amount of damage dealt to an opponent’s port. When an Attack is finalized, you may choose to install a malicious script on your opponent’s system, or choose one of the options that come up depending on what type of port you’ve attacked. For instance, if you’ve attacked an FTP port, you may choose to steal a file, etc.
Like other operations that an individual can perform in Hack Wars, attacking is made possible by installing an application on one of your ports. A basic Attack script can be found in the Hack Wars store. This system allows a player (with a good CPU) to perform multiple attacks at the same time (via multiple attack programs).

Anatomy of an Attack Script

Programs in Hack Wars are based around entry-points. When an event fires to trigger one of these entry-points, the code in your program executes. All programs work in the same way, regardless of whether they’re purchased from the store, dropped by an NPC or bought from another player. Attack has three of these entry-points, each one serving a unique purpose:

Initialize: The code in initialize runs when an attack is first starting. This is a good place to cancel an attack before it really even begins. It is also where you provide malicious hooks into a program for Trojan virus applications that use functions like zombie. What follows is some sample code that you might put into initialize to make sure you do not attack one of your friends:


string friend="192.168.2.002";
if(equal(getTargetIP(),friend)){
  cancelAttack();
} 

continue: Each time that an attack is about to perform its next round of damage on an opponent, continue is called. This is a good place to to come to a decision as to whether or not an attack should be canceled. The following sample code demonstrates how to cancel an attack if it is taking too long to finish:


int max_iterations=15;
if(getIterations()>max_iterations){
  cancelAttack();
} 

finalize: Finalize is called when the health of the port you were attacking has been brought down to 0. You can only perform one finalize function in finalize, a list of which follows (you can combine these with functions that do not finalize, such as message):

showChoices(): Displays a dialog on your desktop allowing you to perform a malicious operation on the port that has been weakened. The options available depend on the type of port that was attacked, and include: stealing petty cash, taking over a player’s website, stealing a file, and peeking at code.
installScript(): Allows you to install your own malicious application over top of an opponent’s existing application. The program you wish to install is provided as a parameter before beginning the attack. These parameters will be discussed in detail in the next section.
emptyPettyCash(): Empties an opponent’s petty cash into your petty cash.
deleteLogs(): Deletes all log entries caused by your IP in the opponent’s log.
destroyWatches(): Destroys all the watches attached to the opponent’s port you are attacking.

What follows is some sample code for finalize that either shows choices or steals petty cash, depending on how much money is present in your opponent’s petty cash:


float steal_amount=1000.0f;
if(checkPettyCash()>=steal_amount){
  emptyPettyCash();
}else{
  showChoices();
} 

Finding Opponents

In Hack Wars you can attack NPCs and other players to gain attack experience and items. You can find NPCs and other players using the in-game search engine Applications -> Web Browser. You can find opponents to attack through various other means: the high-scores, logging them using your watch scripts. The websites of NPCs in the game consist of public domain novels. The easiest target is the novel Maid Marian which consists of several web-pages, the IP range starting at 765.432.1.001.

Tip: Try searching for frequently used words in the search engine to hunt down computers to hack, e.g., agency, store, Toto.

Scanning

Prior to attacking an opponent, it’s a good idea to scan their ports. Scanning an opponent costs $10 and gives you experience towards your scanning level. The amount of experience you get depends on the difference between your level and your opponent’s.
Your scanning level determines how much information you get when you scan an opponent’s ports. It is based on the difference between your scanning level and your firewall level. If, for instance, there is a large difference between your scanning level and their firewall level, you will be able to access information regarding which ports are default, and which firewalls they have installed. If the difference in levels is lesser, you will only be told which type of scripts are installed on their ports.

Overheating

If one of your ports is attacking and begins to take damage, you will find that the CPU cost required to run it begins to rise. If your CPU load ever goes over 100%, your computer will overheat, and all attacks will stop. When your computer is in an overheated state, you will not be able to use programs or start new attacks until your computer stops being overheated. Your computer will no longer be overheated after 90 seconds or when your CPU Load drops below 100% again. Whichever comes last.

You can also use overheating offensively to disable the firewalls on your opponents computer. If you can determine which port you are being attacked from and the IP address of your attacker you can counter-attack and overheat their computer.

Parameters

There are several settings that you can set before an attack begins. These determine what gets installed as a result of installScript and provide settings that can be fetched from within an application. Whether the specific parameters are used depends on the functions called in your Attack script, e.g., installScript must be called, and on the type of port you are attacking—if your opponent’s port is a Bank port, the Bank script you indicate will be used.

Settings in Attack Window

http://www.plink-search.com

Bank Script:

Indicates the compiled bank script that you wish to install when the installScript() function is called upon an attack finalizing. This is only applicable if the attack is targeting a port with a banking program installed.

Attack Script:

Indicates the compiled attacking script that you wish to install when the installScript() function is called upon an attack finalizing. This is only applicable if the attack is targeting a port with an attacking program installed.

FTP Script:

Indicates the compiled FTP script that you wish to install when the installScript() function is called when an attack finalizes. This is only applicable if the attack is targeting a port with an FTP program installed.

Secondary Ports:

Advanced attacking programs can use switchAttack() to cycle through a list of alternate ports to target with the attack. This list of alternate ports is specified here.

Petty Cash Target:

Attacking scripts can check the value provided here and use it to come to a logical decision as to what should be done when an attack is finalized (that is, when it successfully gets the opponent’s port down to 0 health).

Once you have filled out the applicable parameters, click on attack to begin the attack. Information about the attack’s progression will show up in the terminal. You can note that as damage is dealt, you will gain attacking experience. As your attack level increases, you will progressively do more damage and unlock powerful new API functions.


Settings When Choosing Script

http://www.plink-search.com

Malicious IP: This value can be fetched from within a program using the function getMaliciousIP and can be used to set an IP for purchased programs and programs dropped by NPCs.

Petty Cash Target: This value can be fetched from within a program using the value checkPettyCashTarget. This allows you to change the behavior of a script at runtime.

Special Attack Functions

Berserk

berserk() is a method that you can use in continue to deal double damage. On the downside, berserk deals damage to you. If used creatively, berserk can be very powerful. The following code demonstrates berserk in use:


float percent_used=getCPULoad()/getMaximumCPULoad();
if(percent<0.95){
  berserk();
} 

Zombies

The function zombie(ip) can be compiled into the initialize entry-point of an attack program. The IP indicates a player who is allowed to remotely take control of an attack program. If an application using zombie(ip) is installed over top of an opponent’s attack application, you can use that player to perform attacks on your behalf. An example of a zombie application follows:

In Initialize:


zombie(getMaliciousIP()); 

This allows the individual indicated by the malicious IP to hook into this player’s attack port.

In Finalize:


if(isZombie()){
  emptyPettyCash();
}else{
  showChoices();
} 

You can use isZombie() to determine whether the attack currently taking place is a malicious zombie attack. In this way you can provide different functionality when an opponent uses their port than when you maliciously take it over.

Freeze

Can be used to temporarily disable an opponent's ports.