@@ -0,0 +1,227 @@
// kill any scripts from previous run
localHost = getHostname();
scriptKill("_InvestmentBroker_Data.script", localHost);
scriptKill("_InvestmentBroker_Manager.script", localHost);

COMMISION_FEE = 100000;

INPUT_PORT = 10;

// Stock ID (add entries here to handle more stocks)
function GetStockParamId(stockSymbol)
{
if (stockSymbol === "APHE") return 0;
if (stockSymbol === "CTYS") return 1;
if (stockSymbol === "JGN") return 2;
if (stockSymbol === "SGC") return 3;
return -1;
}

// Stock paramaters, according to id returned by GetStockParamId
// Moving Average size, History buffer size, buy/sell threshold (0.01 - 1%)
STOCK_PARAMS = [];
STOCK_PARAMS[0] = [9, 5, 0.01];
STOCK_PARAMS[1] = [5, 10, 0.01];
STOCK_PARAMS[2] = [7, 7, 0.01];
STOCK_PARAMS[3] = [5, 6, 0.01];

// Port assignment per stock
StockPort = [-1, -1, -1, -1];

freePort = 1;

// Managed stock data, each managed stock will have an entry here (with the stock port as index) containing an array with the following data:
// 0 : StockSymbol
// 1 : available cash
// 2 : starting cash
// 3 : starting price
// 4 : total worth
ManagerData = [];

function SaveManagerDataInDB()
{
// Write current managed stock data to file, will be used to restart the script after a reload
write("_Investment_DB.txt","","w");
for (i = 1; i < freePort; i++)
{
if (ManagerData[i][0] !== "")
{
write("_Investment_DB.txt", i + "," + ManagerData[i][0] + "," + ManagerData[i][1] + "," + ManagerData[i][2] + "," + ManagerData[i][3] + "," + ManagerData[i][4] + "|");
}
}
}

previousData = read("_Investment_DB.txt");
if (previousData !== "")
{
// load previous run data
previousData = previousData.split("|");
for (i = 0; i < previousData.length - 1; i++)
{
data = previousData[i].split(",");
stockId = 1 * data[0];
stockSymbol = data[1];
stockParamId = GetStockParamId(stockSymbol);
if (StockPort[stockParamId] > -1)
{
tprint("Duplicate stock " + stockSymbol + " detected in DB!");
}
else
{
ManagerData[stockId] = [];
ManagerData[stockId][0] = stockSymbol;
ManagerData[stockId][1] = 1 * data[2];
ManagerData[stockId][2] = 1 * data[3];
ManagerData[stockId][3] = 1 * data[4];
ManagerData[stockId][4] = 1 * data[5];
if (stockId >= freePort)
{
freePort = stockId + 1;
}
StockPort[stockParamId] = stockId;
}
}

// re-run previous managers with new cash argument
for (i = 1; i < freePort; i++)
{
stockSymbol = ManagerData[i][0];
stockParamId = GetStockParamId(stockSymbol);
run("_InvestmentBroker_Data.script", 1, stockSymbol, i, STOCK_PARAMS[stockParamId][0]);
run("_InvestmentBroker_Manager.script", 1, stockSymbol, i, STOCK_PARAMS[stockParamId][1], STOCK_PARAMS[stockParamId][2], ManagerData[stockId][1]);
}
}

doLoop = true;

while (doLoop)
{
inputCommand = read(INPUT_PORT);
if (inputCommand !== 'NULL PORT DATA')
{
inputCommand = inputCommand.split(" ");
if (inputCommand[0] == "A" && freePort < INPUT_PORT)
{
// Add a new managed stock
stockSymbol = inputCommand[1];
stockParamId = GetStockParamId(stockSymbol);
if (StockPort[stockParamId] > -1)
{
tprint("Stock " + stockSymbol + " already managed!");
}
else
{
run("_InvestmentBroker_Data.script", 1, inputCommand[1], freePort, STOCK_PARAMS[stockParamId][0]);
run("_InvestmentBroker_Manager.script", 1, inputCommand[1], freePort, STOCK_PARAMS[stockParamId][1], STOCK_PARAMS[stockParamId][2], 1 * inputCommand[2]);
print("Adding managed stock " + inputCommand[1] + ", cash: " + inputCommand[2] + "$");
stockPrice = getStockPrice(stockSymbol);
cash = 1 * inputCommand[2];
ManagerData[freePort] = [];
ManagerData[freePort][0] = stockSymbol;
ManagerData[freePort][1] = cash;
ManagerData[freePort][2] = cash;
ManagerData[freePort][3] = stockPrice;
ManagerData[freePort][4] = cash;
SaveManagerDataInDB();
StockPort[stockParamId] = freePort;
freePort++;
}
}

if (inputCommand[0] == "L")
{
// Liquidate stock
stockSymbol = inputCommand[1];
stockParamId = GetStockParamId(stockSymbol);
stockId = StockPort[stockParamId];
if (stockId != -1)
{
// Kill Data gathering script
kill("_InvestmentBroker_Data.script", localHost, stockSymbol, stockId, STOCK_PARAMS[stockParamId][0]);
// Send liquidation command to manage script (it is not killed immediatly to ensure any queued stock transactions will be handled before selling a stock to avoid selling with the wrong price)
write(stockId, "_L");
}
}

if (inputCommand[0] == "__L")
{
// Liquidation response from manage script, script has terminated and any outstanding transactions has been processed
stockId = 1 * inputCommand[1];
stockSymbol = ManagerData[stockId][0];
stockPrice = getStockPrice(stockSymbol);
stockData = getStockPosition(stockSymbol);
profit = stockData[0] * (stockPrice - stockData[1]);
if (profit > COMMISION_FEE * 2)
{
sellStock(stockSymbol, stockData[0]);
print("Sold " + stockSymbol + " shares for " + profit.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$");
ManagerData[stockId][4] = ManagerData[stockId][4] + profit;

}
else
{
sellPrice = stockData[1] + (COMMISION_FEE * 2 / stockData[0]);
placeOrder(stockSymbol, stockData[0], sellPrice, "limitsell", "long");
tprint("placed limit sell order on " + stockSymbol + " for " + stockData[0] + " shares at " + sellPrice.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$");
}
holdProfit = ((ManagerData[stockId][2] - COMMISION_FEE) / ManagerData[stockId][3]) * (stockPrice - ManagerData[stockId][3]);
profit = ManagerData[stockId][4] - ManagerData[stockId][2];
tprint("Final profit for " + stockSymbol + ": " + profit.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$ (" +
holdProfit.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$)");

// End managment for stock
ManagerData[stockId][0] = "";
stockParamId = GetStockParamId(stockSymbol);
StockPort[stockParamId] = -1;
SaveManagerDataInDB();
}

if (inputCommand[0] == "_Sb")
{
// Process stock purchase transaction
stockId = 1 * inputCommand[1];
cost = 1 * inputCommand[2];
print("Bought " + ManagerData[stockId][0] + " shares for " + cost.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$");

// Update available cash reserve
ManagerData[stockId][1] = ManagerData[stockId][1] - cost;
SaveManagerDataInDB();
}

if (inputCommand[0] == "_Ss")
{
// Process stock sale transaction
stockId = 1 * inputCommand[1];
income = 1 * inputCommand[2];
print("Sold " + ManagerData[stockId][0] + " shares for " + income.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$");

// Update available cash reserve and total worth
ManagerData[stockId][1] = ManagerData[stockId][1] + income;
ManagerData[stockId][4] = ManagerData[stockId][1];
SaveManagerDataInDB();
}

if (inputCommand[0] == "S")
{
// Print stock status
totalProfit = 0;
totalHoldProfit = 0;
for (i = 1; i < freePort; i++)
{
if (ManagerData[i][0] !== "")
{
profit = ManagerData[i][4] - ManagerData[i][2];
totalProfit += profit;
stockData = getStockPosition(ManagerData[i][0]);
stockPrice = getStockPrice(ManagerData[i][0]);
holdProfit = ((ManagerData[i][2] - COMMISION_FEE) / ManagerData[i][3]) * (stockPrice - ManagerData[i][3]);
totalHoldProfit += holdProfit;
tprint(ManagerData[i][0] + ": " + stockData[0] + " Shares, Profit: " + profit.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$ (" +
holdProfit.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$)");
}
}
tprint("Total profit: " + totalProfit.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$ (" +
totalHoldProfit.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') + "$)");
}
}
}
@@ -0,0 +1,28 @@
//--------------------------------------------------------------------------------------------------------------------------
//---------------------------_InvestmentBroker_Data.script------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------

StockSymbol = args[0];
DATA_PORT = args[1];
MovingAverageSize = args[1];

prices = [];
sum = 0;
lastPrice = -1;

while(true)
{
price = getStockPrice(StockSymbol);
if (price != lastPrice)
{
prices.push(price);
sum += price;
if (prices.length > MovingAverageSize)
{
sum -= prices.shift();
avg = sum/MovingAverageSize;
write(DATA_PORT, avg);
}
lastPrice = price;
}
}
@@ -0,0 +1 @@
_InvestmentBroker_Data.script
@@ -0,0 +1,97 @@
//--------------------------------------------------------------------------------------------------------------------------
//---------------------------_InvestmentBroker_Manager.script---------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------

COMMISION_FEE = 100000;
INPUT_PORT = 10;

localHost = getHostname();

StockSymbol = args[0];
DATA_PORT = args[1];
HistorySize = args[2];

BuyThreshold = 1 + args[3];
SellThreshold = 1 - args[3];

cash = args[4];

movingAverageHistory = [];

doLoop = true;

while (doLoop)
{
movingAverage = read(DATA_PORT);
if (movingAverage === "_L")
{
// Liquidate command given, terminate script
doLoop = false;
write(INPUT_PORT, "__L " + DATA_PORT);
}
else if (movingAverage !== 'NULL PORT DATA')
{
movingAverageHistory.push(movingAverage);
if (movingAverageHistory.length > HistorySize)
{
previousMovingAverage = movingAverageHistory.shift();
if (movingAverage > (previousMovingAverage * BuyThreshold))
{
// MA is trending up, buy stocks if cash is available
additionalCost = 0;
prevStockData = getStockPosition(StockSymbol);
stockPrice = getStockPrice(StockSymbol);
if (cash > stockPrice + COMMISION_FEE)
{
// Calculate amount of stocks to purchase
newShares = Math.floor((cash - additionalCost - COMMISION_FEE) / stockPrice);
while (!buyStock(StockSymbol, newShares) && newShares > 0)
{
// We failed to buy stocks, adjust cash and retry
availableCash = getServerMoneyAvailable("home");
if (availableCash < cash)
{
// Less cash is available then should be (can happen due to purchase/sell orders happening at a different price then we measured or simply because the user spent the money on something)
// Adjust cost to account for discrepency (I'm adjusting the cose instead of the available cash to reflect the missing cash in the broker script)
additionalCost += (cash - availableCash);
}
// Recalculate amount of stocks to purchase
newShares = Math.floor((cash - additionalCost - COMMISION_FEE) / getStockPrice(StockSymbol));
}
if (newShares > 0)
{
stockData = getStockPosition(StockSymbol);
if (prevStockData[0] === 0)
{
cost = (COMMISION_FEE + (newShares * stockData[1]));
}
else
{
cost = COMMISION_FEE + ((stockData[1] * stockData[0]) - (prevStockData[1] * prevStockData[0]));
}
cost += additionalCost;
cash -= cost;
// Send transaction data to broker
write(INPUT_PORT, "_Sb " + DATA_PORT + " " + cost);
}
}
}
if (movingAverage < (previousMovingAverage * SellThreshold))
{
// MA is trending down, sell stocks if it's profitable
stockData = getStockPosition(StockSymbol);
stockPrice = getStockPrice(StockSymbol);
profit = stockData[0] * (stockPrice - stockData[1]);
if (profit > COMMISION_FEE * 2)
{
sellStock(StockSymbol, stockData[0]);
stockPrice = getStockPrice(StockSymbol);
income = (stockData[0] * stockPrice) - COMMISION_FEE;
cash += income;
// Send transaction data to broker
write(INPUT_PORT, "_Ss " + DATA_PORT + " " + income);
}
}
}
}
}
@@ -0,0 +1,11 @@
//--------------------------------------------------------------------------------------------------------------------------
//---------------------------_InvestmentBroker_Msg.script-------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------

INPUT_PORT = 10;
msg = "";
for (i = 0; i < args.length; i++)
{
msg = msg + args[i] + " ";
}
write(INPUT_PORT, msg);
@@ -0,0 +1,250 @@
servers = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'nectar-net', 'hong-fang-tea', 'harakiri-sushi', 'neo-net', 'zer0', 'max-hardware', 'iron-gym', 'phantasy', 'silver-helix', 'omega-net', 'crush-fitness', 'johnson-ortho', 'the-hub', 'comptek', 'netlink', 'rothman-uni', 'catalyst', 'summit-uni', 'rho-construction', 'millenium-fitness', 'aevum-police', 'alpha-ent', 'syscore', 'lexo-corp', 'snap-fitness', 'global-pharm', 'applied-energetics', 'unitalife', 'nova-med', 'zb-def', 'zb-institute', 'vitalife', 'titan-labs', 'solaris', 'microdyne', 'helios', 'deltaone', 'icarus', 'omnia', 'defcomm', 'galactic-cyber', 'infocomm', 'taiyang-digital', 'stormtech', 'aerocorp', 'clarkeinc', 'omnitek', '4sigma', 'blade', 'b-and-a', 'ecorp', 'fulcrumtech', 'megacorp', 'kuai-gong', 'fulcrumassets', 'powerhouse-fitness'];

purchasedServers = [];

script = args[0];
target = args[1];
scriptRam = getScriptRam('base-target.script', 'home');
allServerRam = getScriptRam('all-server.script', 'home');
portBusters = [];
killCurrentScripts = [];
userStartMoney = getServerMoneyAvailable('home');


numPortsRequiredTarget = (getServerNumPortsRequired(target));
hackingLevelRequiredTarget = (getServerRequiredHackingLevel(target));
userHackingLevel = (getHackingLevel());

//If you don't have a high enough hacking level
if (userHackingLevel < hackingLevelRequiredTarget) {
tprint('You do not have a high enough hacking level for ' + target + '.');
} else {
//Need to have root access to target in order to do anything
//REQUIRES THAT YOU DIDN'T SKIP THE ORDER IN GETTING PORT BUSTERS
//Add port busters to array
if (fileExists('brutessh.exe', 'home') === true) {
portBusters.push('brutessh.exe');
tprint('You own BruteSSH.exe');
}

if (fileExists('ftpcrack.exe', 'home') === true) {
portBusters.push('ftpcrack.exe');
tprint('You own FTPCrack.exe');
}

if (fileExists('relaysmtp.exe', 'home') === true) {
portBusters.push('relaysmtp.exe');
tprint('You own relaySMTP.exe');
}

if (fileExists('httpworm.exe', 'home') === true) {
portBusters.push('httpworm.exe');
tprint('You own HTTPWorm.exe');
}

if (fileExists('sqlinject.exe', 'home') === true) {
portBusters.push('sqlinject.exe');
tprint('You own SQLInject.exe');
}

//You already have root access
if ((hasRootAccess(target)) === true) {
tprint('You already have root access on ' + target + '.');
} else {
//You don't have enough port busters
if ((portBusters.length) < numPortsRequiredTarget) {
tprint('You do not own enough port busters to gain root access to ' + target + '.');
tprint('Moving on to next server.');
} else {
//Opening ports
if ((portBusters.length) === 1) {
brutessh(target);
tprint('Opened port with BruteSSH.');
}

if ((portBusters.length) === 2) {
brutessh(target);
tprint('Opened port with BruteSSH.');
ftpcrack(target);
tprint('Opened port with FTPCrack.');
}

if ((portBusters.length) === 3) {
brutessh(target);
tprint('Opened port with BruteSSH.');
ftpcrack(target);
tprint('Opened port with FTPCrack.');
relaysmtp(target);
tprint('Opened port with relaySMTP.');
}

if ((portBusters.length) === 4) {
brutessh(target);
tprint('Opened port with BruteSSH.');
ftpcrack(target);
tprint('Opened port with FTPCrack.');
relaysmtp(target);
tprint('Opened port with relaySMTP.');
httpworm(target);
tprint('Opened port with HTTPWorm.');
}

if ((portBusters.length) === 5) {
brutessh(target);
tprint('Opened port with BruteSSH.');
ftpcrack(target);
tprint('Opened port with FTPCrack.');
relaysmtp(target);
tprint('Opened port with relaySMTP.');
httpworm(target);
tprint('Opened port with HTTPWorm.');
sqlinject(target);
tprint('Opened port with SQLInject.');
}

nuke(target);
tprint('You now have root access to ' + target + '.');
}
}
}

totalRam = (getServerRam('home')[0]);
usedRam = (getServerRam('home')[1]);
maxThreads = (Math.floor((totalRam - usedRam) / (scriptRam)));

exec(script, 'home', maxThreads, target);
tprint('Script is now running on your home machine.');
/*
nuke('foodnstuff');
killall('foodnstuff');
scp('sleeper.script', 'foodnstuff');
sleep(5000);
exec('sleeper.script', 'foodnstuff', 1, script, target);
tprint('Sleeper script is now running on foodnstuff.');
*/


tprint('////////////////////////////////////////');
tprint('---------- Working on Servers ----------');
tprint('////////////////////////////////////////');


for (i = 0; i < servers.length; i = i + 1) {
currentServer = servers[i];
numPortsRequired = (getServerNumPortsRequired(currentServer));
hackingLevelRequired = (getServerRequiredHackingLevel(currentServer));
userHackingLevel = (getHackingLevel());

tprint('//////////////////////////////////////////////////////');
tprint('---------- Working on ' + currentServer + ' ----------');
tprint('//////////////////////////////////////////////////////');


if (userHackingLevel < hackingLevelRequired) {
tprint('You do not have a high enough hacking level for ' + currentServer + '.');
tprint('Moving on to next server.');
} else {

//REQUIRES THAT YOU HAVE EACH PORT BUSTER IN ORDER AND DIDN'T SKIP IN GETTING ONE

//You already have root access
if ((hasRootAccess(currentServer)) === true) {
tprint('You already have root access on ' + currentServer + '.');
} else {
//You don't have enough port busters
if ((portBusters.length) < numPortsRequired) {
tprint('You do not own enough port busters to gain root access to ' + currentServer + '.');
tprint('Moving on to next server.');
} else {
//Opening ports
if ((portBusters.length) === 1) {
brutessh(currentServer);
tprint('Opened port with BruteSSH.');
}

if ((portBusters.length) === 2) {
brutessh(currentServer);
tprint('Opened port with BruteSSH.');
ftpcrack(currentServer);
tprint('Opened port with FTPCrack.');
}

if ((portBusters.length) === 3) {
brutessh(currentServer);
tprint('Opened port with BruteSSH.');
ftpcrack(currentServer);
tprint('Opened port with FTPCrack.');
relaysmtp(currentServer);
tprint('Opened port with relaySMTP.');
}

if ((portBusters.length) === 4) {
brutessh(currentServer);
tprint('Opened port with BruteSSH.');
ftpcrack(currentServer);
tprint('Opened port with FTPCrack.');
relaysmtp(currentServer);
tprint('Opened port with relaySMTP.');
httpworm(currentServer);
tprint('Opened port with HTTPWorm.');
}

if ((portBusters.length) === 5) {
brutessh(currentServer);
tprint('Opened port with BruteSSH.');
ftpcrack(currentServer);
tprint('Opened port with FTPCrack.');
relaysmtp(currentServer);
tprint('Opened port with relaySMTP.');
httpworm(currentServer);
tprint('Opened port with HTTPWorm.');
sqlinject(currentServer);
tprint('Opened port with SQLInject.');
}

nuke(currentServer);
tprint('You now have root access to ' + currentServer + '.');
}
}

totalRam = (getServerRam(currentServer)[0]);
usedRam = (getServerRam(currentServer)[1]);
maxThreads = (Math.floor((totalRam) / (scriptRam)));

if ((currentServer == 'foodnstuff') === true) {
tprint('Ignoring foodnstuff...');
} else {
if (usedRam > 0) {
tprint('Killing all scripts on ' + currentServer + '.');
killall(currentServer);
sleep(5000);
}
}


if (scriptRam > totalRam) {
tprint('There is not enough RAM on ' + currentServer + ' to run the script.');
tprint('Moving on to next server.');
} else {
scp(script, currentServer);
exec(script, currentServer, maxThreads, target);
if (isRunning(script, currentServer, target) === true) {
tprint(script + ' is now running on ' + currentServer + '.');
} else {
tprint('The script is not running.');
}
}
}
}



tprint('///////////////////////////////////////////////////////////////////////');
tprint('---------- Successfully ran base script on all servers ----------');
tprint('///////////////////////////////////////////////////////////////////////');
tprint(' ');


tprint('///////////////////////////////////');
tprint('---------- *** DONE! *** ----------');
tprint('///////////////////////////////////');

Large diffs are not rendered by default.

@@ -0,0 +1,23 @@
faction = args[0];

possibleAugmentations = getAugmentationsFromFaction(faction);


function commas(x) {
return x.toLocaleString();
}

for (i = 0; i < possibleAugmentations.length; i = i + 1) {
tprint('-------------------------------------------------------------------');
currentAugmentation = possibleAugmentations[i];

repCost = getAugmentationCost(currentAugmentation)[0];
cashCost = getAugmentationCost(currentAugmentation)[1];

tprint('You will need ' + commas(repCost) + ' reputation to purchase ' + currentAugmentation + '.');
tprint('You will need $' + commas(cashCost) + ' to purchase ' + currentAugmentation + '.');
}

tprint('/////////////');
tprint('--- DONE! ---');
tprint('/////////////');
@@ -0,0 +1,24 @@
target = args[0];

moneyThresh = getServerMaxMoney(target) * 0.9;
// moneyThresh = 100000;
securityThresh = round(getServerBaseSecurityLevel(target) / 3) + 2;

while (true) {
if (getServerSecurityLevel(target) > securityThresh) {
//If the server's security level is above our threshold, weaken it
weaken(target);
} else {
//svrSecurityLvl = getServerSecurityLevel(target);
//svrBaseSecurityLvl = getServerBaseSecurityLevel(target);


if (getServerMoneyAvailable(target) < moneyThresh) {
//If the server's money is less than our threshold, grow it
grow(target);
} else {
//Otherwise, hack it
hack(target);
}
}
}
@@ -0,0 +1,30 @@
purchasedServers = [];

script = args[0];
target = args[1];
scriptRam = getScriptRam('base-target.script', 'home');

currentPurchasedServers = getPurchasedServers();

//Start at the max number of possible servers you can buy. Keep buying until that number is 0.
for (i = 25; i > 0; i = i - 1) {
purchasedServersArray = getPurchasedServers();
j = purchasedServersArray.length;
currentPurchasedServer = ('server-' + (j + 1));
purchaseServer(currentPurchasedServer, 1024);
tprint('Purchased a server and named it ' + currentPurchasedServer + '.');
purchasedServers.push(currentPurchasedServer);

totalRam = (getServerRam(currentPurchasedServer)[0]);
usedRam = (getServerRam(currentPurchasedServer)[1]);
maxThreads = (Math.floor((totalRam) / (scriptRam)));

scp(script, currentPurchasedServer);
exec(script, currentPurchasedServer, maxThreads, target);
tprint('Script is now running on ' + currentPurchasedServer + '.');
tprint('Moving on to next server.');
}

tprint('///////////////////////////////////');
tprint('---------- *** DONE! *** ----------');
tprint('///////////////////////////////////');
@@ -0,0 +1,42 @@
script = args[0];
target = args[1];

purchasedServers = [];

scriptRam = getScriptRam('base-target.script', 'home');
allServerRam = getScriptRam('all-server.script', 'home');
homeMoney = getServerMoneyAvailable('home');
moneyPossibleServers = Math.floor(homeMoney / 51200000);
currentPurchasedServers = getPurchasedServers();
limitServers = (25 - currentPurchasedServers.length);
maxPossibleServers = Math.min(moneyPossibleServers, limitServers);

if ((prompt('About to purchase ' + maxPossibleServers + '. Would you like to continue?')) === true) {
//Start at the max number of possible servers you can buy. Keep buying until that number is 0.
for (i = maxPossibleServers; i > 0; i = i - 1) {
purchasedServersArray = getPurchasedServers();
j = purchasedServersArray.length;
currentPurchasedServer = ('server-' + (j + 1));
purchaseServer(currentPurchasedServer, 1024);
tprint('Purchased a server and named it ' + currentPurchasedServer + '.');
purchasedServers.push(currentPurchasedServer);

totalRam = (getServerRam(currentPurchasedServer)[0]);
usedRam = (getServerRam(currentPurchasedServer)[1]);
maxThreads = (Math.floor((totalRam) / (scriptRam)));

scp(script, currentPurchasedServer);
exec(script, currentPurchasedServer, maxThreads, target);
tprint('Script is now running on ' + currentPurchasedServer + '.');
tprint('Moving on to next server.');
tprint('15 seconds...');
sleep(5000);
tprint('10 seconds...');
sleep(5000);
tprint('5 seconds...');
sleep(4000);
tprint('1 second...');
}
} else {
tprint('Okay. Quiting...');
}
@@ -0,0 +1,5 @@
target = args[0];

maxMoney = getServerMaxMoney(target);

tprint(target + ' can have a maximum of ' + maxMoney + ' on it.');
@@ -0,0 +1,30 @@
// crime = args[0];
time = 0;
crime = "";

if (args.length < 2) {
crime = args[0];
} else {
crime = args[0] + ' ' + args[1];
}

if (crime === 'shoplift') {
time = 2000;
}

if (crime === 'mug someone') {
time = 4000;
}


print('Crime = ' + crime + '.');
print('Time = ' + time + '.');


sleep(1000);

for (i = 0; i < 100000000000; i++) {
commitCrime(crime);
sleep(time);
print('You have committed the crime ' + (i + 1) + ' times. Go you.');
}
@@ -0,0 +1,7 @@
sleep(1000);

for (i = 0; i < 100000000000; i = i + 1) {
commitCrime('deal drugs');
sleep(11000);
print('You have delt drugs to ' + (i + 1) + ' punk kids. Go you.');
}
@@ -0,0 +1,13 @@
purchasedServers = ['server-0', 'server-1', 'server-2', 'server-3', 'server-4', 'server-5', 'server-6', 'server-7', 'server-8', 'server-9', 'server-10', 'server-11', 'server-12', 'server-13', 'server-14', 'server-15', 'server-16', 'server-17', 'server-18', 'server-19', 'server-20', 'server-21', 'server-22', 'server-23', 'server-24'];

for (i = 0; i < purchasedServers.length; i = i + 1) {
currentPurchasedServer = purchasedServers[i];

killall(currentPurchasedServer);
tprint('Killing all scripts on ' + currentPurchasedServer + '.');
sleep(5000);
deleteServer(currentPurchasedServer);
tprint(currentPurchasedServer + ' has been deleted.');
}

tprint('Finished deleting purchased servers.');
@@ -0,0 +1,114 @@
// Wait so you can tail the script
sleep(5000);

print('Beginning on combat factions...');

stats = getStats();

if ((prompt('Would you like to join the Slum Snakes?')) === true) {
while (stats.strength < 30) {
currentStrength = stats.strength;
print('Working on strength...');
print('Current strength level = ' + currentStrength + '.');
gymWorkout('Powerhouse Gym', 'strength');
sleep(5000);
stats = getStats();
}

tprint('You now have the minimum strength level for Slum Snakes!');

while (stats.defense < 30) {
currentDefense = stats.defense;
print('Working on defense...');
print('Current strength level = ' + currentDefense + '.');
gymWorkout('Powerhouse Gym', 'defense');
sleep(5000);
stats = getStats();
}

tprint('You now have the minimum defense level for Slum Snakes!');

while (stats.dexterity < 30) {
currentDexterity = stats.dexterity;
print('Working on dexterity...');
print('Current dexterity level = ' + currentDexterity + '.');
gymWorkout('Powerhouse Gym', 'dexterity');
sleep(5000);
stats = getStats();
}

tprint('You now have the minimum dexterity level for Slum Snakes!');

while (stats.agility < 30) {
currentAgility = stats.agility;
print('Working on agility...');
print('Current agility level = ' + currentAgility + '.');
gymWorkout('Powerhouse Gym', 'agility');
sleep(5000);
stats = getStats();
}

tprint('You now have the minimum agility level for Slum Snakes!');
tprint('Working on getting enough money to join...');

for (i = 0; i < 5; i = i + 1) {
print('Commiting crime to gain money...');
commitCrime('larceny');
sleep(93000);
}
}

commitCrime('homicide');
sleep(5000);

if ((prompt('Do you want to continue to go for the Tetrads?')) === true) {
print('Traveling to New Tokyo...');
travelToCity('New Tokyo');

while (stats.strength < 75) {
currentStrength = stats.strength;
print('Working on strength...');
print('Current strength level = ' + currentStrength + '.');
gymWorkout('Powerhouse Gym', 'strength');
sleep(5000);
stats = getStats();
}

tprint('You now have the minimum strength level for Tetrads!');

while (stats.defense < 75) {
currentDefense = stats.defense;
print('Working on defense...');
print('Current strength level = ' + currentDefense + '.');
gymWorkout('Powerhouse Gym', 'defense');
sleep(5000);
stats = getStats();
}

tprint('You now have the minimum defense level for Tetrads!');

while (stats.dexterity < 75) {
currentDexterity = stats.dexterity;
print('Working on dexterity...');
print('Current dexterity level = ' + currentDexterity + '.');
gymWorkout('Powerhouse Gym', 'dexterity');
sleep(5000);
stats = getStats();
}

tprint('You now have the minimum dexterity level for Tetrads!');

while (stats.agility < 75) {
currentAgility = stats.agility;
print('Working on agility...');
print('Current agility level = ' + currentAgility + '.');
gymWorkout('Powerhouse Gym', 'agility');
sleep(5000);
stats = getStats();
}

tprint('You now have the minimum agility level for Tetrads!');
} else {
commitCrime('homicide');
tprint('---DONE!---');
}
@@ -0,0 +1,43 @@
currentNiteSecRep = 0;
currentBlackHandRep = 0;
currentBitRunnersRep = 0;

function commas(x) {
return x.toLocaleString();
}

while (currentNiteSecRep < 112500) {
difference = 112500 - currentNiteSecRep;
workForFaction('NiteSec', 'hacking');
sleep(15000);
print('You still need ' + commas(difference) + ' reputation.');

currentNiteSecRep = getFactionRep('NiteSec');
}

print('You have enough reputation with NiteSec. Moving on...');

while (currentBlackHandRep < 125000) {
difference = 125000 - currentBlackHandRep;
workForFaction('The Black Hand', 'hacking');
sleep(15000);
print('You still need ' + commas(difference) + ' reputation.');

currentBlackHandRep = getFactionRep('The Black Hand');
}

print('You have enough reputation with NiteSec. Moving on...');

while (currentBitRunnersRep < 1000000) {
difference = 1000000 - currentBitRunnersRep;
workForFaction('BitRunners', 'hacking');
sleep(15000);
print('You still need ' + commas(difference) + ' reputation.');

currentBitRunnersRep = getFactionRep('BitRunners');
}

print('You have enough reputation with BitRunners...');
if ((prompt('You probably woke up by now. You did it!')) === true) {

}
@@ -0,0 +1,89 @@
//servers = ['unitalife', 'aerocorp', 'stormtech', 'univ-energy', 'nova-med', 'zeus-med', 'deltaone', 'fulcrumtech', 'global-pharm', 'blade', 'omnitek', 'clarkeinc', '4sigma', 'b-and-a', 'kuai-gong', 'nwo', 'megacorp', 'ecorp'];
servers = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'nectar-net', 'hong-fang-tea', 'harakiri-sushi', 'neo-net', 'zer0', 'max-hardware', 'iron-gym', 'phantasy', 'silver-helix', 'omega-net', 'crush-fitness', 'johnson-ortho', 'the-hub', 'comptek', 'netlink', 'rothman-uni', 'catalyst', 'summit-uni', 'rho-construction', 'millenium-fitness', 'aevum-police', 'alpha-ent', 'syscore', 'lexo-corp', 'snap-fitness', 'global-pharm', 'applied-energetics', 'unitalife', 'nova-med', 'zb-def', 'zb-institute', 'vitalife', 'titan-labs', 'solaris', 'microdyne', 'helios', 'deltaone', 'icarus', 'omnia', 'defcomm', 'galactic-cyber', 'infocomm', 'taiyang-digital', 'stormtech', 'aerocorp', 'clarkeinc', 'omnitek', '4sigma', 'blade', 'b-and-a', 'ecorp', 'fulcrumtech', 'megacorp', 'kuai-gong', 'fulcrumassets', 'powerhouse-fitness'];
thisServer = args[0];
//scriptRam = getScriptRam(script, 'home');
scriptRam = 1.50;
totalRam = ((getServerRam('home')[0]) - (getServerRam('home')[1]));
maxThreads = (Math.floor(totalRam / scriptRam));
totalLoot = 0;

function commas(x) {
return x.toLocaleString();
}

function toTime(x) {
timeArray = [];

if (x > 60) {
timeArray.push(Math.trunc(x / 60));
timeArray.push(x - (Math.trunc(x / 60) * 60));
} else {
timeArray.push(0);
timeArray.push(Math.ceil(x));
}
return (timeArray);
}

for (i = 0; i < servers.length; i = i + 1) {
currentServer = servers[i];
startMoney = getServerMoneyAvailable(currentServer);
hackTime = toTime(getHackTime(currentServer));

//Make sure to have all 5 portbusters
//exec('open-sesame.script', thisServer, 1, currentServer, 5);
//tprint('Executed open-sesame to open ' + currentServer + '.');
//sleep(4000);

tprint('------------------------------------------------');

brutessh(currentServer);
ftpcrack(currentServer);
relaysmtp(currentServer);
httpworm(currentServer);
sqlinject(currentServer);
nuke(currentServer);

tprint('You now have root access on ' + currentServer + '.');
/*
while (scriptRunning('open-sesame.script', thisServer) === true) {
sleep(8000);
}
*/

//killall('home');
//tprint('Killing all scripts on home machine...');
//sleep(8000);

exec('RemoteHack.script', 'home', maxThreads, currentServer);
tprint('Executed RemoteHack to hack ' + currentServer + '.');

if (hackTime[0] !== 0) {
tprint('It will take ' + commas(hackTime[0]) + ' minutes, and ' + hackTime[1] + ' seconds to hack ' + currentServer + '.');
} else {
tprint('It will take ' + hackTime[1] + ' seconds to hack ' + currentServer + '.');
}

tprint('Sleeping...');
while (scriptRunning('RemoteHack.script', 'home') === true) {
sleep(8000);
//tprint('RemoteHack still working on ' + currentServer + '. Sleeping...');
}

tprint('Finished hacking ' + currentServer + '.');
tprint('You just gained $' + (commas(startMoney)) + '.');
tprint('--- TEST --- startMoney = ' + commas(startMoney));

totalLoot = (totalLoot + startMoney);
tprint('--- TEST --- totalLoot = ' + totalLoot);

tprint('Your total loot now = $' + (commas(totalLoot)) + '.');
}

tprint('-------------------------------------------------------');
tprint('All of the servers on the list have been hacked 1 time.');
tprint('-------------------------------------------------------');
tprint('In total, you gained $' + totalLoot);
tprint('-------------------------------------------------------');
tprint('/////////////');
tprint('--- DONE! ---');
tprint('/////////////');
@@ -0,0 +1,64 @@
/*target = args[0];

function commas(x) {
return x.toLocaleString();
}

while (true) {
if (getServerMoneyAvailable !== 0) {
//weaken(target);
preHackMoney = getServerMoneyAvailable(target);
tprint('////////////////////////////');
tprint('Hacking ' + target + '.');
hack(target);
postHackMoney = getServerMoneyAvailable(target);
takeAway = (preHackMoney - postHackMoney);
tprint('You stole $' + commas(takeAway) + '. Nice.');
tprint('There is currently $' + commas((getServerMoneyAvailable(target))) + ' available.');
} else {
tprint('/////////////////////////////////////');
tprint('No more money on ' + target + '!');
}
}

tprint('///////////');
tprint('---DONE!---');
tprint('///////////');
*/


basicServers = ['sigma-cosmetics'];
scriptRam = 1.50;
totalRam = ((getServerRam('home')[0]) - (getServerRam('home')[1]));
maxThreads = (Math.floor(totalRam / scriptRam));


function commas(x) {
return x.toLocaleString();
}

for (i = 0; i < basicServers.length; i = i + 1) {
target = basicServers[i];

while (getServerMoneyAvailable(target) > 75000) {
//weaken(target);
preHackMoney = getServerMoneyAvailable(target);
tprint('///////////////////////////////////////////////');
tprint('Hacking ' + target + '...');
exec('RemoteHack.script', 'home', maxThreads, target);
while ((scriptRunning('RemoteHack.script', 'home')) === true) {
sleep(3000);
}
postHackMoney = getServerMoneyAvailable(target);
takeAway = (preHackMoney - postHackMoney);
tprint('You stole $' + commas(takeAway) + '. Nice.');
tprint('There is currently $' + commas((getServerMoneyAvailable(target))) + ' available.');
}

tprint('///////////////////////////////////////////////');
tprint('Not enough money on ' + target + ' to care!');
}

tprint('///////////');
tprint('---DONE!---');
tprint('///////////');
@@ -0,0 +1,17 @@
faction = args[0];
repMax = args[1];
factionRep = 0;


while (factionRep < repMax) {
workForFaction(faction, 'hacking');
sleep(30000);
factionRep = getFactionRep(faction);
print('You currently have ' + factionRep + ' reputation with ' + faction + '.');
}

if ((prompt('You now have ' + repMax + ' reputation with ' + faction + '. Select either option to kill script.')) === true) {

} else {

}
@@ -0,0 +1,40 @@
//Used to kill all scripts on all non-faction servers and purchased servers.

svrs = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'nectar-net', 'hong-fang-tea', 'harakiri-sushi', 'neo-net', 'zer0', 'max-hardware', 'iron-gym', 'phantasy', 'silver-helix', 'omega-net', 'crush-fitness', 'johnson-ortho', 'the-hub', 'comptek', 'netlink', 'rothman-uni', 'catalyst', 'summit-uni', 'rho-construction', 'millenium-fitness', 'aevum-police', 'alpha-ent', 'syscore', 'lexo-corp', 'snap-fitness', 'global-pharm', 'applied-energetics', 'unitalife', 'nova-med', 'zb-def', 'zb-institute', 'vitalife', 'titan-labs', 'solaris', 'microdyne', 'helios', 'deltaone', 'icarus', 'omnia', 'defcomm', 'galactic-cyber', 'infocomm', 'taiyang-digital', 'stormtech', 'aerocorp', 'clarkeinc', 'omnitek', '4sigma', 'blade', 'b-and-a', 'ecorp', 'fulcrumtech', 'megacorp', 'kuai-gong', 'fulcrumassets', 'powerhouse-fitness'];

pSvrs = ['server-0', 'server-1', 'server-2', 'server-3', 'server-4', 'server-5', 'server-6', 'server-7', 'server-8', 'server-9', 'server-10', 'server-11', 'server-12', 'server-13', 'server-14', 'server-15', 'server-16', 'server-17', 'server-18', 'server-19', 'server-20', 'server-21', 'server-22', 'server-23', 'server-24'];


tprint('///////////////////////////////////////////////');
tprint(' Killing all scripts on all servers... ');
tprint('///////////////////////////////////////////////');


//Kill all scripts on all servers.
for (i = 0; i < svrs.length; i = i + 1) {
currentSvr = svrs[i];

killall(svrs[i]);
}




//Kill all scripts on all purchased servers.
for (i = 0; i < pSvrs.length; i = i + 1) {
//currentPSvr = Psvrs[i];

killall(pSvrs[i]);
}


tprint('////////////////////////////////////////////////////////');
tprint(' All scripts on all servers successfully killed ');
tprint('////////////////////////////////////////////////////////');

tprint(' DONE! ');



//!*!*!* If you want to kill this script, along with all others on your home server, comment in the next line.
//killall('home');
@@ -0,0 +1,5 @@
for (i = 0; i < 100000000000; i = i + 1) {
commitCrime('larceny');
sleep(93000);
print('You have committed larceny ' + (i + 1) + ' times. Go you.');
}
@@ -0,0 +1,179 @@
//Define Variables
currentScanLength = 0;
scanArray = ['home'];
Servers = [];
ServersM = []; // Money
ServersHL = []; // HackingLevel
ServersHP = []; // HackingPorts
ServersP = []; // Profits
basehackinglevel = -101;
target = 'foodnstuff';
host = 'home';
mults = getHackingMultipliers();

//Skill Multiplier Constants
hackmult = mults.money;
growmult = mults.growth;
//Bitnode Multiplier Constants, update after changing Bitnodes
bitnodehackmult = 1.0000;
bitnodegrowmult = 1.0000;
bitnodeweakenmult = 1.0000;


//Scan Loop
while (currentScanLength < scanArray.length) {
currentHost = scanArray[currentScanLength];
newScan = scan(currentHost);
for (j = 0; j < newScan.length; j++) {
if (scanArray.indexOf(newScan[j]) == -1) {
scanArray.push(newScan[j]);
money = getServerMaxMoney(newScan[j]);
if (money > 0) {
Servers.push(newScan[j]);
ServersM.push(money);
ServersHP.push(getServerNumPortsRequired(newScan[j]));
ServersHL.push(getServerRequiredHackingLevel(newScan[j]));
time = 2 * getWeakenTime(newScan[j]) + getGrowTime(newScan[j]) + getHackTime(newScan[j]);
profit = round(money / time);
ServersP.push(profit);
}
}
}
currentScanLength++;
}

//Main Loop
while (true) {

portBusters = ['BruteSSH.exe', 'FTPCrack.exe', 'relaySMTP.exe', 'HTTPWorm.exe', 'SQLInject.exe'];
numPortBreakers = 0;
for (i = 0; i < portBusters.length; i++) {
if (fileExists(portBusters[i], 'home')) {
numPortBreakers++;
}
}

hackinglevel = getHackingLevel();
print(basehackinglevel);

//Recalc & RetargetProfits if Hacking level has increased by 100
if (hackinglevel > basehackinglevel + 100) {
basehackinglevel = hackinglevel;
//Reset Profits
ServersP = [];
for (j = 0; j < Servers.length; j++) {
time = 2 * getWeakenTime(Servers[j]) + getGrowTime(Servers[j]) + getHackTime(Servers[j]);
profit = round(ServersM[j] / time);
ServersP.push(profit);
}

print(Servers);
print('Create Eligable Target List');
targetlist = [];
targetlistP = [];
for (j = 0; j < Servers.length; j++) {
if (ServersHP[j] <= numPortBreakers && ServersHL[j] <= hackinglevel) {
targetlist.push(Servers[j]);
targetlistP.push(ServersP[j]);
}
}

print(targetlist);
print('Find Optimal Target List');

OptimalTargetList = [];
OptimalTargetListM = [];
OptimalTargetListG = [];
OptimalTargetListHL = [];
OptimalTargetListMS = [];

for (i = 0; i < Math.min(targetlist.length,10); i++) {
targetmaxprofit = 0;
for (j = 0; j < targetlist.length; j++) {
if (targetlistP[j] > targetmaxprofit) {
targetmaxprofit = targetlistP[j];
}
}
index = targetlistP.indexOf(targetmaxprofit);
OptimalTargetList.push(targetlist[index]);
OptimalTargetListG.push(getServerGrowth(targetlist[index]));
OptimalTargetListHL.push(getServerRequiredHackingLevel(targetlist[index]));
OptimalTargetListMS.push(Math.max(round(getServerBaseSecurityLevel(targetlist[index])/3),1));
OptimalTargetListM.push(getServerMaxMoney(targetlist[index]));
targetlistP[index] = 0;
}
print(OptimalTargetList);

}


//Loop Through Targets
for (k = 0; k < Math.min(OptimalTargetList.length,10); k++) {
homeram = getServerRam('home');

if (homeram[0] - homeram[1] < 2) {
print('Not enough RAM available');
k = 1000;
break;
}

freememory = homeram[0] - homeram[1];
target = OptimalTargetList[k];
minsecurity = OptimalTargetListMS[k];
reqHack = OptimalTargetListHL[k];
maxmoney = OptimalTargetListM[k];
growth = OptimalTargetListG[k];

//Calculate number of Hack Threads Required
perhack = (100-minsecurity) * ((hackinglevel-reqHack+1)/hackinglevel) / 24000 * hackmult * bitnodehackmult;
hacks = Math.ceil(1/perhack);

security = minsecurity + hacks * 0.002;
//Calculate number of Grow Threads Required
growpercent = Math.min(1 + 0.03/security,1.0035);
pergrow = Math.pow(growpercent,growth/100 * growmult * bitnodegrowmult);
var1 = maxmoney * Math.log(pergrow);
lambert = Math.log(var1)-Math.log(Math.log(var1))-Math.log(1-Math.log(Math.log(var1))/Math.log(var1));
grows = Math.ceil(lambert/Math.log(pergrow));

//Calculate number of Weaken Threads Required
weakens = Math.ceil((((hacks * 0.002) + (grows * 0.004)) / (0.05 * bitnodeweakenmult)));
maxweakens = (100 - minsecurity) / (0.05 * bitnodeweakenmult);
if (weakens > maxweakens) {weakens = maxweakens}

//Adjust if max threads > max memory
if (weakens * 1.55 > freememory) {
weakens = Math.max(Math.floor(freememory / 1.555),1);
}
if (hacks * 1.55 > freememory) {
hacks = Math.max(Math.floor(freememory / 1.555),1);
}
if (grows * 1.55 > freememory) {
grows = Math.max(Math.floor(freememory / 1.555),1);
}

if (hasRootAccess(target) == false) {
if (numPortBreakers > 4)
sqlinject(target);
if (numPortBreakers > 3)
httpworm(target);
if (numPortBreakers > 2)
relaysmtp(target);
if (numPortBreakers > 1)
ftpcrack(target);
if (numPortBreakers > 0)
brutessh(target);
nuke(target);
}

if (isRunning('RemoteWeaken.script',host,target) == false && isRunning('RemoteHack.script',host,target) == false && isRunning('RemoteGrow.script',host,target) == false) {
if (getServerSecurityLevel(target) > getServerBaseSecurityLevel(target) / 3 + 6) {
exec('RemoteWeaken.script', host, weakens, target);
} else if (getServerMoneyAvailable(target) >= 0.75 * getServerMaxMoney(target)) {
exec('RemoteHack.script', host, hacks, target);
} else {
exec('RemoteGrow.script', host, grows, target);
}
}
}
}
@@ -0,0 +1,217 @@
//Servers with 0 port
//serverZeroPort = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'hong-fang-tea', 'harakiri-sushi'];

//target = args[0];

//Servers with 1 port.
//serverOnePort = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'nectar-net', 'hong-fang-tea', 'harakiri-sushi', 'neo-net', 'zer0', 'max-hardware', 'iron-gym'];

//All servers that aren't faction servers.
servers = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'nectar-net', 'hong-fang-tea', 'harakiri-sushi', 'neo-net', 'zer0', 'max-hardware', 'iron-gym', 'phantasy', 'silver-helix', 'omega-net', 'crush-fitness', 'johnson-ortho', 'the-hub', 'comptek', 'netlink', 'rothman-uni', 'catalyst', 'summit-uni', 'rho-construction', 'millenium-fitness', 'aevum-police', 'alpha-ent', 'syscore', 'lexo-corp', 'snap-fitness', 'global-pharm', 'applied-energetics', 'unitalife', 'nova-med', 'zb-def', 'zb-institute', 'vitalife', 'titan-labs', 'solaris', 'microdyne', 'helios', 'deltaone', 'icarus', 'omnia', 'defcomm', 'galactic-cyber', 'infocomm', 'taiyang-digital', 'stormtech', 'aerocorp', 'clarkeinc', 'omnitek', '4sigma', 'blade', 'b-and-a', 'ecorp', 'fulcrumtech', 'megacorp', 'kuai-gong', 'fulcrumassets', 'powerhouse-fitness'];

tprint('//////////////////////////////////');
tprint(' Starting Up... ');
tprint('//////////////////////////////////');

tprint(' ');
tprint('//////////////////////////////////////');
tprint(' Running script on Servers... ');
tprint('//////////////////////////////////////');

target = args[0];


pservers = ['server-0', 'server-1', 'server-2', 'server-3', 'server-4', 'server-5', 'server-6', 'server-7', 'server-8', 'server-9', 'server-10', 'server-11', 'server-12', 'server-13', 'server-14', 'server-15', 'server-16', 'server-17', 'server-18', 'server-19', 'server-20', 'server-21', 'server-22', 'server-23', 'server-24'];
//target = args[0];




i = 0;
while(i < 25) {
if (getServerMoneyAvailable("home") > 51200000) {
purchaseServer("server-" + i, 1024);

//exec("early-hack-template.script", hostname, 1, "joesguns", 1000000000, 10);
++i;
}
}

for (j = 0; j < pservers.length; j = j + 1) {
currentServer = pservers[j];

//scp('RemoteGrow.script', 'home', currentServer);
//scp('RemoteHack.script', 'home', currentServer);
//scp('RemoteWeaken.script', 'home', currentServer);
//scp('shit.script', 'home', currentServer);

serverRamAvailable = ((getServerRam(currentServer)[0]) - (getServerRam(currentServer)[1]));
scriptRam = 1.75;
maxThreads = (Math.floor((serverRamAvailable) / (scriptRam)));


if (hasRootAccess(target) === false) {
if (fileExists('brutessh.exe', 'home') === true)
brutessh(target);
if (fileExists('ftpcrack.exe', 'home') === true)
ftpcrack(target);
if (fileExists('relaysmtp.exe', 'home') === true)
relaysmtp(target);
if (fileExists('httpwork.exe', 'home') === true)
httpworm(target);
if (fileExists('sqlinject.exe', 'home') === true)
sqlinject(target);
nuke(target);
}


scp('constant-weaken.script', 'home', currentServer);

exec('constant-weaken.script', currentServer, maxThreads, target);

print('Ya got shit runnin on ' + currentServer + ' yo.');
}

tprint('Bruh the script is done buyin shit and runnin shit on it.');






//host = args[0];

//maxThreads = Math.floor((((getServerRam(host)[0]) - (getServerRam(host)[1])) / 1.75));


homeRamAvailable = ((getServerRam('home')[0]) - (getServerRam('home')[1]));
homeScriptRam = getScriptRam('base-target.script', 'home');
homeThreads = (Math.floor((homeRamAvailable / 1.75)));

exec('constant-weaken.script', 'home', homeThreads, target);

for (i = 0; i < servers.length; i = i + 1) {
currentServer = servers[i];

if ((isRunning('constant-weaken.script', currentServer)) === false) {
while (getServerRequiredHackingLevel(currentServer) > getHackingLevel()) {
sleep(10000);
}

serverRamAvailable = ((getServerRam(currentServer)[0]) - (getServerRam(currentServer)[1]));
scriptRam = 1.75;

if (serverRamAvailable >= scriptRam) {
maxThreads = (Math.floor((serverRamAvailable) / (scriptRam)));

scp('constant-weaken.script', currentServer);

brutessh(currentServer);
ftpcrack(currentServer);
relaysmtp(currentServer);
httpworm(currentServer);
sqlinject(currentServer);
nuke(currentServer);


/*
if (hasRootAccess(currentServer) === false) {
if (fileExists('brutessh.exe', 'home') === true)
brutessh(currentServer);
if (fileExists('ftpcrack.exe', 'home') === true)
ftpcrack(currentServer);
if (fileExists('relaysmtp.exe', 'home') === true)
relaysmtp(currentServer);
if (fileExists('httpwork.exe', 'home') === true)
httpworm(currentServer);
if (fileExists('sqlinject.exe', 'home') === true)
sqlinject(currentServer);
nuke(currentServer);
}
*/

exec('constant-weaken.script', currentServer, maxThreads, target);
print('Script is running on ' + currentServer + '.');
} else {
print('There was an error or there was not enough ram on the server');
}
} else {
print('Script is already running on ' + currentServer + '.');
}



}

/*
if ((scriptRunning('base-target.script', currentServer)) === true) {
print('Script already running on ' + currentServer + '.');
} else if ((usrHackLvl >= reqHackLvl && serverRamAvailable >= scriptRam) === true) {
maxThreads = (Math.floor((serverRamAvailable) / (scriptRam)));
scp('base-target.script', currentServer);
nuke(currentServer);
exec('base-target.script', currentServer, maxThreads, target);
print('Script is running on ' + currentServer + '.');
} else {
sleep(10000);
print('Waiting for usrHackLvl to increase...');
}
}
tprint(' ');
tprint('/////////////////////////////////////');
tprint(' Script is running on all Servers. ');
tprint('/////////////////////////////////////');
tprint(' ');
tprint('////////////////////////////');
tprint(' Working on home... ');
tprint('////////////////////////////');
serverRamAvailable = Math.floor((getServerRam('home')[0]) - (getServerRam('home')[1]));
scriptRam = getScriptRam('base-target.script', 'home');
if ((scriptRunning('base-target.script', 'home')) === true) {
print('Script already running on home.');
} else if (serverRamAvailable >= scriptRam) {
/*
for (i = 0; i < serverZeroPort.length; i = i + 1) {
targetServer = serverZeroPort[i];
maxThreads = (Math.floor((serverRamAvailable) / (scriptRam)));
exec('base-target.script', 'home', maxThreads, targetServer);
tprint(' ');
tprint('//////////////////////////////////////');
tprint(' Scripts are running on home. ');
tprint('//////////////////////////////////////');
}
} else {
tprint(' ');
tprint('///////////////////////////////////////////');
tprint(' Not enough RAM available on home. ');
tprint('///////////////////////////////////////////');
}
maxThreads = Math.floor((serverRamAvailable - getScriptRam('main-start-earlygame.script', 'home')) / scriptRam);
exec('base-target.script', 'home', maxThreads, target);
}
*/






tprint(' ');
tprint('//////////////////////////////');
tprint(' *** DONE! *** ');
tprint('//////////////////////////////');
@@ -0,0 +1,164 @@
/*
Only works if you have enough multipliers to the point where growing a server will increase your hack exp signficantly.
*/


//Servers with 1 port.
SvrOnePort = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'nectar-net', 'hong-fang-tea', 'harakiri-sushi', 'neo-net', 'zer0', 'max-hardware', 'iron-gym'];

//All servers that aren't faction servers.
scanArray = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'nectar-net', 'hong-fang-tea', 'harakiri-sushi', 'neo-net', 'zer0', 'max-hardware', 'iron-gym', 'phantasy', 'silver-helix', 'omega-net', 'crush-fitness', 'johnson-ortho', 'the-hub', 'comptek', 'netlink', 'rothman-uni', 'catalyst', 'summit-uni', 'rho-construction', 'millenium-fitness', 'aevum-police', 'alpha-ent', 'syscore', 'lexo-corp', 'snap-fitness', 'global-pharm', 'applied-energetics', 'unitalife', 'nova-med', 'zb-def', 'zb-institute', 'vitalife', 'titan-labs', 'solaris', 'microdyne', 'helios', 'deltaone', 'icarus', 'omnia', 'defcomm', 'galactic-cyber', 'infocomm', 'taiyang-digital', 'stormtech', 'aerocorp', 'clarkeinc', 'omnitek', '4sigma', 'blade', 'b-and-a', 'ecorp', 'fulcrumtech', 'megacorp', 'kuai-gong', 'fulcrumassets', 'powerhouse-fitness'];

tprint('//////////////////////////////////');
tprint(' Starting Up... ');
tprint('//////////////////////////////////');


/*
tprint('//////////////////////////');
tprint('Purchasing Hacknet node...');
tprint('//////////////////////////');
//Buy a hacknet node.
purchaseHacknetNode();
tprint(' ');
tprint('//////////////////////////////////////');
tprint('Successfully purchased 1 hacknet node.');
tprint('//////////////////////////////////////');
//Run the hacknet script.
exec('hacknet-test.script', 'home');
tprint(' ');
tprint('//////////////////////////////');
tprint('Hacknet script is now running.');
tprint('//////////////////////////////');
*/

tprint(' ');
tprint('///////////////////////////////////////////////////');
tprint('Hacking all cash available on all 1 port servers...');
tprint('///////////////////////////////////////////////////');


//Go through 1 port server list. If the server isn't being targeted, target it. If there is no more cash, kill the target script. Move on to the next server.
for (i = 0; i < SvrOnePort.length; i = i + 1) {
targetOnePort = SvrOnePort[i];
// maxThreads = ((getServerRam('home')[1]) / 2.60);
// currentCash = getServerMoneyAvailable(targetOnePort);

//!!! Remember to change to the max threads you can run for your home RAM. Currently configured for 65,536.00 GB of RAM.
if ((scriptRunning('base-target.script', 'home')) === false) {
exec('base-target.script', 'home', 476500, targetOnePort);
}

if ((scriptRunning('base-target.script', 'home')) === true) {
print('base-target script still running');
sleep(10000);
}

sleep(10000);
}


tprint(' ');
tprint('///////////////////////////////////////////////');
tprint('All servers have been hacked of all their cash.');
tprint('///////////////////////////////////////////////');


//Run the main server script on the home server
exec('main-server', 'home');


tprint(' ');
tprint('////////////////////////////');
tprint('Running main script on home.');
tprint('////////////////////////////');
tprint(' ');
tprint('///////////////////////////////////');
tprint('Main script is now running on home.');
tprint('///////////////////////////////////');


tprint(' ');
tprint('//////////////////////');
tprint('Buying 1 TB servers...');
tprint('//////////////////////');


//Once you've gone through the 1 port servers and taken all availabel cash, execute script to buy *25* 1 TB servers).
exec('buy-servers.script', 'home');


//If you are still buying servers, wait for 5 seconds and check again.
while ((isRunning('buy-servers.script', 'home')) === true) {
sleep(5000);
}


tprint(' ');
tprint('/////////////////////////////////');
tprint('Sucessfully purchased 25 servers.');
tprint('/////////////////////////////////');
tprint(' ');
tprint('///////////////////////////////////////////');
tprint('Running main script on purchased servers...');
tprint('///////////////////////////////////////////');

//Once you aren't buying servers anymore, run the script too run 'main-server.script' on all your purchased servers.
exec('all-server.script', 'home');


//If you are still running the all server script, wait for 5 seconds and check again.
while((isRunning('all-server.script', 'home')) === true) {
sleep(5000);
}


tprint(' ');
tprint('///////////////////////////////////////////////////');
tprint('Main server script is running on purchased servers.');
tprint('///////////////////////////////////////////////////');
tprint(' ');
tprint('///////////////////////////////////');
tprint('Working on all available servers...');
tprint('///////////////////////////////////');


//Go through all other servers. Copy necessary scripts to them. Run the main-server.script on each one.
for (i = 0; i < scanArray.length; i++) {
//Copy scripts to each server in the array.
scp('main-server.script', scanArray[i]);
scp('RemoteGrow.script', scanArray[i]);
scp('RemoteHack.script', scanArray[i]);
scp('RemoteWeaken.script', scanArray[i]);

tprint(' ');
tprint('/////////////////////////////////');
tprint('Scripts copied to ' + scanArray[i]);
tprint('/////////////////////////////////');

//Run the main server script on each server in the array.
exec('main-server.script', scanArray[i]);

tprint(' ');
tprint('////////////////////////////////////////////////////');
tprint('Main server script is now running on ' + scanArray[i]);
tprint('////////////////////////////////////////////////////');
}



tprint(' ');
tprint('///////////////////////////////////');
tprint(' Main Start DONE! ');
tprint('///////////////////////////////////');
@@ -0,0 +1,166 @@
reputation = 0;
stats = getStats();

function commas(x) {
return x.toLocaleString();
}

function text(statement) {
print('-----------------------------------------------------------------');
print(statement);
print('-----------------------------------------------------------------');
}


/////////////////////////////////////////////
// FIRST PROMOTION - Junior Software Engineer
/////////////////////////////////////////////


text('Applying with Megacorp...');
applyToCompany('MegaCorp', 'software');
text('Successfully got a job with MegaCorp in Software!');
text('Working for Megacorp...');

// Waiting for promotion rep requirement
while (reputation < 8000) {
difference = 8000 - reputation;
workForCompany();
sleep(30000);
reputation = getCompanyRep('MegaCorp');
text('You still need ' + commas(difference) + ' reputation to get promoted.');
}

// Check promotion hacking level requirement
while (stats.hacking < 300) {
difference = 300 - stats.hacking;
sleep(30000);
stats = getStats();
text('You still need ' + difference + ' more hacking levels to get promoted.');
}

text('Applying for promotion...');
if ((applyToCompany('MegaCorp', 'software')) === true) {
text('You have been promoted!');
} else {
text('You did not satisfy the requirements for a promotion...');
}


//////////////////////////////////////////////
// SECOND PROMOTION - Senior Software Engineer
//////////////////////////////////////////////


// Waiting for promotion rep requirement
while (reputation < 40000) {
difference = 40000 - reputation;
workForCompany();
sleep(30000);
reputation = getCompanyRep('MegaCorp');
text('You still need ' + commas(difference) + ' reputation to get promoted.');
}

// Check promotion hacking level requirement
while (stats.hacking < 500) {
difference = 500 - stats.hacking;
sleep(30000);
stats = getStats();
text('You still need ' + difference + ' more hacking levels to get promoted.');
}

// Check promotion charisma level requirement
while (stats.charisma < 300) {
difference = 300 - stats.charisma;
universityCourse('Rothman University', 'Leadership');
sleep(30000);
stats = getStats();
text('You still need ' + difference + ' more charisma levels to get promoted.');
}

text('Applying for promotion...');
if ((applyToCompany('MegaCorp', 'software')) === true) {
text('You have been promoted!');
} else {
text('You did not satisfy the requirements for a promotion...');
}


////////////////////////////////////////////
// THIRD PROMOTION - Lead Software Developer
////////////////////////////////////////////


// Waiting for promotion rep requirement
while (reputation < 200000) {
difference = 200000 - reputation;
workForCompany();
sleep(30000);
reputation = getCompanyRep('MegaCorp');
text('You still need ' + commas(difference) + ' reputation to get promoted.');
}

// Check promotion hacking level requirement
while (stats.hacking < 650) {
difference = 650 - stats.hacking;
sleep(30000);
stats = getStats();
text('You still need ' + difference + ' more hacking levels to get promoted.');
}

// Check promotion charisma level requirement
while (stats.charisma < 400) {
difference = 400 - stats.charisma;
universityCourse('Rothman University', 'Leadership');
sleep(30000);
stats = getStats();
text('You still need ' + difference + ' more charisma levels to get promoted.');
}

text('Applying for promotion...');
if ((applyToCompany('MegaCorp', 'software')) === true) {
text('You have been promoted!');
} else {
text('You did not satisfy the requirements for a promotion...');
}


///////////////////
// FOURTH PROMOTION
///////////////////


// Waiting for promotion rep requirement
while (reputation < 400000) {
difference = 400000 - reputation;
workForCompany();
sleep(30000);
reputation = getCompanyRep('MegaCorp');
text('You still need ' + commas(difference) + ' reputation to get promoted.');
}

// Check promotion hacking level requirement
while (stats.hacking < 750) {
difference = 750 - stats.hacking;
sleep(30000);
stats = getStats();
text('You still need ' + difference + ' more hacking levels to get promoted.');
}

// Check promotion charisma level requirement
while (stats.charisma < 500) {
difference = 500 - stats.charisma;
universityCourse('Rothman University', 'Leadership');
sleep(30000);
stats = getStats();
text('You still need ' + difference + ' more charisma levels to get promoted.');
}

text('Applying for promotion...');
if ((applyToCompany('MegaCorp', 'software')) === true) {
text('You have been promoted!');
} else {
text('You did not satisfy the requirements for a promotion...');
}

workForCompany();
@@ -0,0 +1,30 @@
target = args[0];

function commas(x) {
return x.toLocaleString();
}

// preMoney = 0;
money = commas(getServerMoneyAvailable(target));
// postMoney = 0;

while (true) {
tprint(target + ' currently has $' + money + ' available.');
sleep(30000);
money = commas(getServerMoneyAvailable(target));
/*
if (preMoney === 0) {
tprint('This was the initialization.');
} else {
takeAway = 0;
if (takeAway === 0) {
tprint('There has not been any change in cash.');
takeAway = commas(money - preMoney);
} else {
takeAway = commas(money - preMoney);
tprint('In the past 30 seconds, ' + target + ' has grown by $' + takeAway + '.');
}
}
preMoney = commas(getServerMoneyAvailable(target));
*/
}
@@ -0,0 +1,20 @@
factions = ['Tian Di Hui', 'NiteSec', 'New Tokyo', 'Ishima', 'Volhaven', 'Chongqing', 'Sector-12'];
factionRep = [5000, 6250, 6250, 7500, 15000, 37500, 50000];
userRep = [0];

for (i = 0; i < factions.length; i = i + 1) {
currentFaction = factions[i];
currentRepGoal = factionRep[i];

while (userRep[0] < currentRepGoal) {
workForFaction(currentFaction, 'hacking');
sleep(30000);
currentFactionRep = getFactionRep(currentFaction);
userRep.unshift(currentFactionRep);
userRepLeft = currentRepGoal - userRep[0];
print('You currently have ' + userRep[0] + ' reputation with ' + currentFaction + '.');
print('You still have ' + userRepLeft + ' reputation points to get to your goal of ' + currentRepGoal + '.');
}

userRep.unshift(0);
}
@@ -0,0 +1,49 @@
target = args[0];
numPortBusters = args[1];

if (numPortBusters === 0) {
nuke(target);
tprint(target + ' is open fa bidnez.');
}

if (numPortBusters === 1) {
brutessh(target);
nuke(target);
tprint(target + ' is open fa bidnez.');
}

if (numPortBusters === 2) {
brutessh(target);
ftpcrack(target);
nuke(target);
tprint(target + ' is open fa bidnez.');
}

if (numPortBusters === 3) {
brutessh(target);
ftpcrack(target);
relaysmtp(target);
nuke(target);
tprint(target + ' is open fa bidnez.');
}

if (numPortBusters === 4) {
brutessh(target);
ftpcrack(target);
relaysmtp(target);
httpworm(target);
nuke(target);
tprint(target + ' is open fa bidnez.');
}

if (numPortBusters === 5) {
brutessh(target);
ftpcrack(target);
relaysmtp(target);
httpworm(target);
sqlinject(target);
nuke(target);
tprint(target + ' is open fa bidnez.');
}

tprint('///// --- DONE! --- /////');
@@ -0,0 +1,90 @@
// Change the desired starting script
script = 'base-target.script';

scriptRam = getScriptRam(script, 'home');
totalRam = (getServerRam('home')[0]);
usedRam = (getServerRam('home')[1]);
maxThreads = (Math.floor((totalRam) / (scriptRam)));

// Wait for starter script on home to die
sleep(1500);

if ((fileExists('BruteSSH.exe', 'home')) === true) {
tprint('You own BruteSSH.exe.');
tprint('Taking algorithms course at Rothman University...');
sleep(2000);

playerStats = getStats();

exec(script, 'home', maxThreads, 'foodnstuff');

while (playerStats.hacking < 100) {
universityCourse('Rothman University', 'algorithms');
sleep(10000);
playerStats = getStats();
print('Player hacking level = ' + playerStats.hacking);
}

commitCrime('homicide');

tprint('You now have the requirements to hack iron-gym');
killall('home');
sleep(5000);
exec('all-server.script', 'home', 1, 'base-target.script', 'foodnstuff');
} else {
tprint('You do not own BruteSSH.exe.');
tprint('Taking algorithms course at Rothman University...');
sleep(2000);

playerStats = getStats();

while (playerStats.hacking < 50) {
universityCourse('Rothman University', 'algorithms');
sleep(10000);
playerStats = getStats();
print('Player hacking level = ' + playerStats.hacking);
}

commitCrime('homicide');
sleep(5000);

tprint('Your hacking level is now 50.');
tprint('Running all-server.script...');

tprint('Sleeping for 30 seconds...');
exec('all-server.script', 'home', 1, 'base-target.script', 'foodnstuff');
sleep(10000);
tprint('20 seconds left...');
sleep(10000);
tprint('10 seconds left...');
sleep(5000);
tprint('5 seconds left...');
sleep(5000);

tprint('Creating BruteSSH.exe...');
sleep(2000);

createProgram('BruteSSH.exe');

while ((isBusy()) === true) {
sleep(10000);
}

tprint('BruteSSH.exe has been created.');

if (playerStats.hacking < 100) {
while (playerStats.hacking < 100) {
universityCourse('Rothman University', 'algorithms');
sleep(10000);
playerStats = getStats();
tprint('Player hacking level = ' + playerStats.hacking);
}
}

commitCrime('homicide');

tprint('You now have the requirements to hack iron-gym');
killall('home');
sleep(7000);
exec('all-server.script', 'home', 1, 'base-target.script', 'foodnstuff');
}
@@ -0,0 +1,27 @@
servers = ['server-0', 'server-1', 'server-2', 'server-3', 'server-4', 'server-5', 'server-6', 'server-7', 'server-8', 'server-9', 'server-10', 'server-11', 'server-12', 'server-13', 'server-14', 'server-15', 'server-16', 'server-17', 'server-18', 'server-19', 'server-20', 'server-21', 'server-22', 'server-23', 'server-24'];
target = args[0];

i = 0;
while(i < 25) {
if (getServerMoneyAvailable("home") > 51200000) {
purchaseServer("server-" + i, 1024);

//exec("early-hack-template.script", hostname, 1, "joesguns", 1000000000, 10);
++i;
}
}

for (j = 0; j < servers.length; j = j + 1) {
currentServer = servers[j];

scp('RemoteGrow.script', 'home', currentServer);
scp('RemoteHack.script', 'home', currentServer);
scp('RemoteWeaken.script', 'home', currentServer);
scp('shit.script', 'home', currentServer);

exec('shit.script', currentServer, 1, currentServer, target);

print('Ya got shit runnin on ' + currentServer + ' yo.');
}

print('Bruh the script is done.');
@@ -0,0 +1,20 @@
faction = 'NiteSec';
augmentation = 'Cranial Signal Processors - Gen III';
augmentationCost = getAugmentationCost(augmentation)[1];
money = 0;

function commas(x) {
return x.toLocaleString();
}

while (money < augmentationCost) {
difference = augmentationCost - money;
tprint('You still need $' + commas(difference) + ' to buy ' + augmentation + '.');
print('You still need $' + commas(difference) + ' to buy ' + augmentation + '.');
sleep(30000);
money = getServerMoneyAvailable('home');
}

purchaseAugmentation('NiteSec', 'Cranial Signal Processors - Gen III');
tprint('You now have Cranial Signal Processors - Gen III');
tprint('--- DONE! ---');
@@ -0,0 +1,31 @@
//RAM FINDER

Srvs = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'nectar-net', 'hong-fang-tea', 'harakiri-sushi', 'neo-net', 'zer0', 'max-hardware', 'iron-gym', 'phantasy', 'silver-helix', 'omega-net', 'crush-fitness', 'johnson-ortho', 'the-hub', 'comptek', 'netlink', 'rothman-uni', 'catalyst', 'summit-uni', 'rho-construction', 'millenium-fitness', 'aevum-police', 'alpha-ent', 'syscore', 'lexo-corp', 'snap-fitness', 'global-pharm', 'applied-energetics', 'unitalife', 'nova-med', 'zb-def', 'zb-institute', 'vitalife', 'titan-labs', 'solaris', 'microdyne', 'helios', 'deltaone', 'icarus', 'omnia', 'defcomm', 'galactic-cyber', 'infocomm', 'taiyang-digital', 'stormtech', 'aerocorp', 'clarkeinc', 'omnitek', '4sigma', 'blade', 'b-and-a', 'ecorp', 'fulcrumtech', 'megacorp', 'kuai-gong', 'fulcrumassets', 'powerhouse-fitness'];

eligible = [];

tprint('/////////////////////////////////////////////////////');
tprint('----- Creating list of eligible servers -----');
tprint('/////////////////////////////////////////////////////');



for (i = 0; i < Srvs.length; i = i +1) {
currentSrv = Srvs[i];
srvRam = (getServerRam(currentSrv));

if (((srvRam[0]) > 16.00) === true) {
eligible.push(currentSrv);
}
}


tprint(' ');
tprint(' ');
tprint('////////////////////////////////////////////');
tprint('----- List of eligible servers -----');
tprint('////////////////////////////////////////////');
tprint(' ');
tprint(eligible);
tprint(' ');
tprint('----- *** DONE! *** -----');
@@ -0,0 +1,33 @@
//1% of current funds, per cycle.
allowancePercentage = 0.99;
while (true) {
currentCash = ((getServerMoneyAvailable('home')) * (allowancePercentage));
if (getNextHacknetNodeCost() <= currentCash) {
purchaseHacknetNode();
print('Bought a new node.');
} else {
for (i = 0; i < hacknetnodes.length; i++) {
node = hacknetnodes[i];
upgradeCost = node.getLevelUpgradeCost(1);
if (upgradeCost <= currentCash) {
node.upgradeLevel(1);
print('Upgraded level.');
break;
} else {
ramCost = node.getRamUpgradeCost();
if (ramCost <= currentCash) {
node.upgradeRam();
print('Upgraded ram.');
break;
} else {
coreCost = node.getCoreUpgradeCost();
if (coreCost <= currentCash) {
node.upgradeCore();
print('Upgraded core.');
break;
}
}
}
}
}
}
@@ -0,0 +1,348 @@
// Change the desired starting script
script = 'base-target.script';

// Change to the desired reputation before restart
goalRep = 100000;

factionServer = args[0];
faction = args[1];
requiredHackingLevel = getServerRequiredHackingLevel(factionServer);
requiredPortBusters = getServerNumPortsRequired(factionServer);
userHackingLevel = getHackingLevel();
userMoney = getServerMoneyAvailable('home');
portBustersCost = 0;
currentFactionRep = 0;
portBusters = [];

scriptRam = getScriptRam(script, 'home');
totalRam = (getServerRam('home')[0]);
usedRam = (getServerRam('home')[1]);
maxThreads = (Math.floor((totalRam) / (scriptRam)));

// Wait for starter script on home to die
sleep(1500);

function commas(x) {
return x.toLocaleString();
}


// How many port busters do you already have?
if (fileExists('brutessh.exe', 'home') === true) {
portBusters.push('brutessh.exe');
tprint('You own BruteSSH.exe');
}

if (fileExists('ftpcrack.exe', 'home') === true) {
portBusters.push('ftpcrack.exe');
tprint('You own FTPCrack.exe');
}

if (fileExists('relaysmtp.exe', 'home') === true) {
portBusters.push('relaysmtp.exe');
tprint('You own relaySMTP.exe');
}

if (fileExists('httpworm.exe', 'home') === true) {
portBusters.push('httpworm.exe');
tprint('You own HTTPWorm.exe');
}

if (fileExists('sqlinject.exe', 'home') === true) {
portBusters.push('sqlinject.exe');
tprint('You own SQLInject.exe');
}

ownedPortBusters = portBusters.length;
tprint('You own ' + ownedPortBusters + ' port busters.');
neededPortBusters = requiredPortBusters - ownedPortBusters;
tprint('You will need to buy ' + neededPortBusters + ' more port busters.');


// How many port busters are required to hack the server?
if (requiredPortBusters === 5) {
if (neededPortBusters === 5) {
portBusterCost = 287000000;
}

if (neededPortBusters === 4) {
portBusterCost = 286500000;
}

if (neededPortBusters === 3) {
portBusterCost = 285000000;
}

if (neededPortBusters === 2) {
portBusterCost = 280000000;
}

if (neededPortBusters === 1) {
portBusterCost = 250000000;
}

if (neededPortBusters === 0) {
portBusterCost = 0;
}

print('You will need $' + commas(portBusterCost) + ' to buy necessary port busters.');
}

// How many port busters do you still need to buy?
if (requiredPortBusters === 4) {
if (neededPortBusters === 4) {
portBusterCost = 37000000;
}

if (neededPortBusters === 3) {
portBusterCost = 36500000;
}

if (neededPortBusters === 2) {
portBusterCost = 35000000;
}

if (neededPortBusters === 1) {
portBusterCost = 30000000;
}

if (neededPortBusters === 0) {
portBusterCost = 0;
}

print('You will need $' + commas(portBusterCost) + ' to buy necessary port busters.');
}

if (requiredPortBusters === 3) {
if (neededPortBusters === 3) {
portBusterCost = 7000000;
}

if (neededPortBusters === 2) {
portBusterCost = 6500000;
}

if (neededPortBusters === 1) {
portBusterCost = 5000000;
}

if (neededPortBusters === 0) {
portBusterCost = 0;
}

print('You will need $' + commas(portBusterCost) + ' to buy necessary port busters.');
}

tprint('DID YOU MAKE IT HERE?');

if (requiredPortBusters === 2) {
if (neededPortBusters === 2) {
portBusterCost = 2000000;
}

if (neededPortBusters === 1) {
portBusterCost = 1500000;
}

if (neededPortBusters === 0) {
portBusterCost = 0;
}

print('You will need $' + commas(portBusterCost) + ' to buy necessary port busters.');
}

if (requiredPortBusters === 1) {
if (neededPortBusters === 1) {
portBusterCost = 500000;
}

if (neededPortBusters === 0) {
portBusterCost = 0;
}

print('You will need $' + commas(portBusterCost) + ' to buy necessary port busters.');
}

// If you have as many port busters as you need
if (neededPortBusters === 0) {
portBusterCost = 0;
print('You do not need to buy any additional port busters to hack ' + factionServer + '.');
}

tprint('Running script to gain hacking experience and money...');
exec(script, 'home', maxThreads, 'foodnstuff');

if (userHackingLevel < requiredHackingLevel) {
userHackingLevel = getHackingLevel();
difference = requiredHackingLevel - userHackingLevel;

tprint('You do not have a high enough hacking level to hack the server.');
tprint('You need ' + commas(difference) + ' experience to be able to hack ' + factionServer + '.');
}

while (userMoney < (portBusterCost + 200000)) {
userMoney = getServerMoneyAvailable('home');
difference = portBusterCost - userMoney;

print('Not enough money to buy port busters...');
tprint('You need $' + commas(difference) + ' to buy enough portbusters.');
sleep(30000);
}

purchaseTor();

if (requiredPortBusters === 5) {
tprint('Purchasing necessary port busters...');
purchaseProgram('BruteSSH.exe');
tprint('Bought BruteSSH.exe');
purchaseProgram('FTPCrack.exe');
tprint('Bought FTPCrack.exe');
purchaseProgram('relaySMTP.exe');
tprint('Bought relaySMTP.exe');
purchaseProgram('HTTPWorm.exe');
tprint('Bought HTTPWorm.exe');
purchaseProgram('SQLInject.exe');
tprint('Bought SQLInject.exe');
print('You now have the necessary port busters.');
}

if (requiredPortBusters === 4) {
tprint('Purchasing necessary port busters...');
purchaseProgram('BruteSSH.exe');
tprint('Bought BruteSSH.exe');
purchaseProgram('FTPCrack.exe');
tprint('Bought FTPCrack.exe');
purchaseProgram('relaySMTP.exe');
tprint('Bought relaySMTP.exe');
purchaseProgram('HTTPWorm.exe');
tprint('Bought HTTPWorm.exe');
print('You now have the necessary port busters.');
}

if (requiredPortBusters === 3) {
tprint('Purchasing necessary port busters...');
purchaseProgram('BruteSSH.exe');
tprint('Bought BruteSSH.exe');
purchaseProgram('FTPCrack.exe');
tprint('Bought FTPCrack.exe');
purchaseProgram('relaySMTP.exe');
tprint('Bought relaySMTP.exe');
print('You now have the necessary port busters.');
}

if (requiredPortBusters === 2) {
tprint('Purchasing necessary port busters...');
purchaseProgram('BruteSSH.exe');
tprint('Bought BruteSSH.exe');
purchaseProgram('FTPCrack.exe');
tprint('Bought FTPCrack.exe');
print('You now have the necessary port busters.');
}

if (requiredPortBusters === 1) {
tprint('Purchasing necessary port busters...');
purchaseProgram('BruteSSH.exe');
tprint('Bought BruteSSH.exe');
print('You now have the necessary port busters.');
}

userHackingLevel = getHackingLevel();

while (userHackingLevel < requiredHackingLevel) {
print('You do not have enough hacking experience.');
print('Sleeping for 30 seconds...');
sleep(30000);
userHackingLevel = getHackingLevel();
}

if ((prompt('You now have the requirements to hack ' + factionServer + '. You must now connect to the server, and hack it manually. Do you understand?')) === true) {
tprint('Opening up the server...');

if (requiredPortBusters === 5) {
brutessh(factionServer);
ftpcrack(factionServer);
relaysmtp(factionServer);
httpworm(factionServer);
sqlinject(factionServer);
}

if (requiredPortBusters === 4) {
brutessh(factionServer);
ftpcrack(factionServer);
relaysmtp(factionServer);
httpworm(factionServer);
}

if (requiredPortBusters === 3) {
brutessh(factionServer);
ftpcrack(factionServer);
relaysmtp(factionServer);
}

if (requiredPortBusters === 2) {
brutessh(factionServer);
ftpcrack(factionServer);
}

if (requiredPortBusters === 1) {
brutessh(factionServer);
}

nuke(factionServer);

if (hasRootAccess(factionServer) === true) {
tprint('You now have root access to ' + factionServer + '.');
} else {
tprint('There was an error, and you do not have root access to ' + factionServer + '.');
}

tprint('Finding location of ' + factionServer + '...');
killall('home');
sleep(5000);
exec('tracert.script', 'home', 1, factionServer);
} else {
tprint('Bruh. You best understand you need to hack dis shit manually...');
}

sleep(30000)

if ((prompt('Are you ready to begin earning faction reputation?')) === true) {
tprint('Killing all scripts on home machine...');
killall('home');
sleep(4000);
tprint('Executing all-server.script ...');
exec('all-server.script', 'home', 1, script, phantasy);
} else {
tprint('Sleeping for another 30 seconds...');
sleep(30000);
}

tprint('Waiting for you to set off on main servers...');
sleep(60000);

if ((prompt('Have you finished with the main servers?')) === true) {
tprint('Great. Beginning to gain faction reputation...');
sleep(3000);
} else {
tprint('Sleeping for another 30 seconds...');
sleep(30000);
}

tprint('Joining ' + faction + '...');
joinFaction(faction);
tprint('Successfully joined ' + faction + '.');
tprint('Beginning faction work...');


while (currentFactionRep < goalRep) {
print('You currently have ' + commas(currentFactionRep) + ' reputation for ' + faction + '.');
workForFaction(faction, 'hacking');
print('Sleeping for 30 seconds...');
sleep(30000);
commitCrime('homicide');
sleep(5000);
currentFactionRep = getFactionRep(faction);
}

tprint('You have reached your goal of ' + commas(goalRep) + ' reputation for ' + faction + '.');
tprint('---DONE!---');
@@ -0,0 +1,141 @@
/*
POSTED BY:
u/RafnarC (https://www.reddit.com/user/RafnarC)
POSTED ON:
October 12th, 2017
COMMENT CONTEXT:
"I've been spending a lot of time in the first run on the singularity bitnode and as such have made a script to level my reputation in all of the faction i am currently in and can join. I still consider my self a netscript neonate so any coments improvements would be welcome.
...
Edit updated script to use if (workForFaction(knownfactions[i], 'hacking') || workForFaction(knownfactions[i], 'fieldwork')) for detecting if your in a faction Edit added the the faction culling after you can get all their augments now to find out how to reduce the size but 10-15 gb"
REDDIT POST:
https://www.reddit.com/r/Bitburner/comments/75thik/reputation_script/
*/



function work(faction){
while (getFactionRep(faction) < rep) {
if(!workForFaction(faction, "hacking")){
workForFaction(faction,"fieldwork");
}
sleep(sleeptime);
}
}

function workjob(company){
if(company!="Joe's Guns"){
applyToCompany(company,"software");
} else{
applyToCompany(company,"employee");
}
while (getCompanyRep(company) < corprep) {
workForCompany();
sleep(sleeptime);
}
}

//list of all corp
corps = ["MegaCorp", "Blade Industries", "Four Sigma", "KuaiGong International", "NWO", "OmniTek Incorporated", "ECorp", "Bachman & Associates", "Clarke Incorporated", "Fulcrum Technolgies"];
//list of all factions
knownfactions = ["Sector-12", "Aevum", "Tian Di Hui", "Chongqing", "New Tokyo", "Ishima", "Volhaven", "CyberSec", "NiteSec", "The Black Hand", "BitRunners", "Fulcrum Secret Technologies", "Bachman & Associates", "MegaCorp", "KuaiGong International", "Clarke Incorporated", "Blade Industries", "Four Sigma", "ECorp", "OmniTek Incorporated", "Netburners", "Slum Snakes", "Daedalus", "Tetrads", "Illuminati", "The Covenant", "NWO"];
// creating the a list of faction your already in
currentfactions =[];
deletefactions= [];
// other preset veriables
rep = 5000;
maxcorprep = 250000;
corprep = 10000;
corpindex = 0;
sleeptime =240000;
//starting the loop
while (true){
// check faction invites and accept them then remove them from the knowfacttions list
invites = checkFactionInvitations();
if (invites.length > 0 ){
for (i=0; i<invites.length;i++){
joinFaction(invites[i]);
currentfactions.push(invites[i]);
index = knownfactions.indexOf(invites[i]);
if (index > -1){
knownfactions.splice(index, 1);
}
}
}


// check and see if your are already in a faction and add it to the working list
deletefactions = [];
for(i=0;i<knownfactions.length;i++){
if (workForFaction(knownfactions[i], 'hacking') || workForFaction(knownfactions[i], 'fieldwork')){
//tprint("adding to list "+ knownfactions[i]);
currentfactions.push(knownfactions[i]);
deletefactions.push(knownfactions[i]);
}
}
for (i=0;i<deletefactions.length; i++ ){

index = knownfactions.indexOf(deletefactions[i]);
if (index > -1){
knownfactions.splice(index, 1);
}
}

//Cull faction you can already buy all augments from (excluding "NeuroFlux Governor")
actionaugs= [];
cullfactions= [];
for(i=0;i<currentfactions.length;i++){
factionaugs = getAugmentationsFromFaction(currentfactions[i]);
topaug=1;
for(n=0;n<factionaugs.length;n++){
if (factionaugs[n]!="NeuroFlux Governor"){
topaug=Math.max(getAugmentationCost(factionaugs[n])[0], topaug);
}
}
if (getFactionRep(currentfactions[i])>topaug){
cullfactions.push(currentfactions[i]);
}
}
tprint("done");
for(i=0;i<cullfactions.length;i++){
index = currentfactions.indexOf(cullfactions[i]);
if (index > -1){
currentfactions.splice(index,1);
}

}



//Check if your in a faction to get rep from
if(currentfactions.length>0){

// work for faction
for (i=0;i<currentfactions.length;i++){
work(currentfactions[i]);
}
rep += 10000;
}
//work job
if(getHackingLevel()>250){
if (corpindex < corps.length){
workjob(corps[corpindex]);
corprep += 10000;
// switching to a new corp if your rep is above 250000 or the set maxcorprep
if (getCompanyRep(corps[corpindex]) > maxcorprep ){
corpindex++;
corprep = 10000;
}
}
} else {
workjob("Joe's Guns");
}
//if(getStatLevel('Cha')<1000){
travelToCity('Volhaven');
universityCourse('ZB Institute of Technology','Leadership');
sleep(sleeptime*2);
//}

}
@@ -0,0 +1,5 @@
for (i = 0; i < 100000000000; i = i + 1) {
commitCrime('rob store');
sleep(62000);
print('You have robbed ' + (i + 1) + ' stores. Go you.');
}
@@ -0,0 +1,24 @@
servers = ['foodnstuff', 'sigma-cosmetics', 'joesguns', 'hong-fang-tea', 'harakiri-sushi', 'iron-gym', 'neo-net', 'nectar-net', 'zer0', 'max-hardware', 'silver-helix', 'phantasy', 'omega-net','rothman-uni', 'comptek', 'johnson-ortho', 'server-0', 'server-1', 'server-2', 'server-3', 'server-4', 'server-5' ,'server-6', 'server-7', 'server-8', 'server-9', 'server-10'];
script = 'base-target.script';
scriptRam = getScriptRam('base-target.script', 'home');
target = args[0];


for (i = 0; i < servers.length; i = i + 1) {
currentServer = servers[i];

killall(currentServer);
sleep(8000);


totalRam = (getServerRam(currentServer)[0]);
maxThreads = (Math.floor((totalRam) / (scriptRam)));


scp(script, 'home', currentServer);
exec(script, currentServer, maxThreads, target);

tprint('Done working on ' + currentServer);
}

tprint('Bruh that shit is done.');
@@ -0,0 +1,77 @@
function calcGainRate(X, Y, Z) {
return (X*1.6) * Math.pow(1.035,Y-1) * ((Z+5)/6);
}
function gainFromLevelUpgrade(X, Y, Z) {
return (1*1.6) * Math.pow(1.035,Y-1) * ((Z+5)/6);
}
function gainFromRamUpgrade(X, Y, Z) {
return (X*1.6) * (Math.pow(1.035,(2*Y)-1) - Math.pow(1.035,Y-1)) * ((Z+5)/6);
}
function gainFromCoreUpgrade(X, Y, Z) {
return (X*1.6) * Math.pow(1.035,Y-1) * (1/6);
}
function hNodes(){ //Wrapper to save on RAM costs
return hacknetnodes;
}
function upgradeNodeLevel(X, i, levels){ //Wrapper to save on RAM costs
print("Node " + i + ": Attempting Level Upgrade: " + hNodes()[i].upgradeLevel(levels));
}
function upgradeNodeRam(Y, i){ //Wrapper to save on RAM costs
print("Node " + i + ": Attempting RAM Upgrade: " + hNodes()[i].upgradeRam());
}
function upgradeNodeCore(Z, i){ //Wrapper to save on RAM costs
print("Node " + i + ": Attempting Core Upgrade: " + hNodes()[i].upgradeCore());
}

breakevenTime = 3600*4;//Time in seconds

//Ensure at least one node has been purchased
if(hNodes().length === 0) purchaseHacknetNode();

//Calculate the gain multiplier by checking actual gain vs theoretical
firstNode = hNodes()[0];
X = firstNode.level;
Y = firstNode.ram;
Z = firstNode.cores;
gainMul = firstNode.moneyGainRatePerSecond/calcGainRate(X,Y,Z);

checkForMoreUpgrades = true;
while(checkForMoreUpgrades) {
checkForMoreUpgrades = false;

//Update the first node
if ( (X < 200) &&
(firstNode.getLevelUpgradeCost(1) < (breakevenTime * gainMul * gainFromLevelUpgrade(X, Y, Z))) ) {
upgradeNodeLevel(X,0,1);
checkForMoreUpgrades = true;
}
if ( (Y < 64) &&
(firstNode.getRamUpgradeCost() < (breakevenTime * gainMul * gainFromRamUpgrade(X, Y, Z))) ) {
upgradeNodeRam(Y,0);
checkForMoreUpgrades = true;
}
if ( (Z < 16) &&
(firstNode.getCoreUpgradeCost() < (breakevenTime * gainMul * gainFromCoreUpgrade(X, Y, Z))) ) {
upgradeNodeCore(Z,0);
checkForMoreUpgrades = true;
}

//Buy more nodes if cost effective
if( getNextHacknetNodeCost() < (breakevenTime * hNodes()[0].moneyGainRatePerSecond / 2) ) {
i = purchaseHacknetNode();
print("Bought a new node: " + i);
checkForMoreUpgrades = true;
}

//Match all extra nodes to the first node
for (i = 1; i < hNodes().length; i++){
while(hNodes()[i].level < hNodes()[0].level)
upgradeNodeLevel(hNodes()[i].level, i,(hNodes()[0].level - hNodes()[i].level));
while(hNodes()[i].ram < hNodes()[0].ram)
upgradeNodeRam(hNodes()[i].ram, i);
while(hNodes()[i].cores < hNodes()[0].cores)
upgradeNodeCore(hNodes()[i].cores, i);
}
}

tprint("Done.");
@@ -0,0 +1,5 @@
for (i = 0; i < 100000000000; i = i + 1) {
commitCrime('larceny');
sleep(93000);
print('You have committed larceny ' + (i + 1) + ' times. Go you.');
}