Basic Setup

Minimal bits and pieces to make following the writeups a little easier.

Hosts File

While using HTB I have found it easier to add hostnames to /etc/hosts for machines such as machinename.htb. This makes it easier to define a machine when going back through commands rather than trying to remember which IP address is associated with a certain machine. You can checkout this gist for a ready-made hosts file or copy the contents below:       localhost       htb

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

# Active    ropetwo.htb    worker.htb    omni.htb    feline.htb    passage.htb    compromised.htb    crossfit.htb    doctor.htb    reel2.htb    jewel.htb    bucket.htb    apt.htb    time.htb    academy.htb    laboratory.htb    cereal.htb    luanne.htb    sharp.htb    ready.htb    attended.htb

# Retired      lame.htb      legacy.htb      devel.htb      popcorn.htb      beep.htb      optimum.htb      bastard.htb     tenten.htb     arctic.htb     cronos.htb     grandpa.htb     granny.htb     october.htb     brainfuck.htb     lazy.htb     sneaky.htb     joker.htb	europa.htb     haircut.htb     holiday.htb	calamity.htb     bank.htb	charon.htb	jail.htb	blocky.htb	blue.htb	nineveh.htb	apocalyst.htb	shrek.htb	mirai.htb	solidstate.htb	mantis.htb	kotarak.htb	shocker.htb	minion.htb	node.htb	tally.htb	sense.htb	enterprise.htb	fulcrum.htb	jeeves.htb	stratosphere.htb	ariekei.htb	nightmare.htb	inception.htb     bashed.htb	fluxcapacitor.htb	canape.htb	rabbit.htb	fighter.htb	falafel.htb	chatterbox.htb	nibbles.htb	sunday.htb	reel.htb	aragog.htb	valentine.htb	crimestoppers.htb	bart.htb	silo.htb	olympus.htb	poison.htb	celestial.htb	dab.htb	waldo.htb	tartarsauce.htb	smasher.htb	dropzone.htb	devoops.htb	mischief.htb	bounty.htb	reddish.htb	jerry.htb	oz.htb	secnotes.htb     access.htb	active.htb	ghoul.htb	hawk.htb	sizzle.htb	giddy.htb	carrier.htb	ethereal.htb	ypuffy.htb	zipper.htb	vault.htb    craft.htb	frolic.htb	bighead.htb	redcross.htb    bitlab.htb    haystack.htb	conceal.htb	irked.htb	lightweight.htb	chaos.htb	help.htb	ctf.htb	friendzone.htb	flujab.htb	querier.htb	unattended.htb	fortune.htb	hackback.htb	kryptos.htb	arkham.htb	lacasadepapel.htb	helpline.htb	onetwoseven.htb	bastion.htb	smasher2.htb	luke.htb	writeup.htb	ellingson.htb	swagshop.htb	chainsaw.htb	jarvis.htb    re.htb    player.htb    networked.htb	safe.htb    rope.htb    heist.htb	curling.htb    sniper.htb	netmon.htb	teacher.htb    bankrobber.htb    scavenger.htb    zetta.htb	wall.htb    json.htb    registry.htb    postman.htb    forest.htb    mango.htb    ai.htb    traverxec.htb    control.htb    obscurity.htb    resolute.htb    playertwo.htb    monteverde.htb    patents.htb    fatty.htb    sauna.htb    book.htb    oouch.htb    nest.htb    multimaster.htb    remote.htb	traceback.htb    cascade.htb    forwardslash.htb    servmon.htb    magic.htb    quick.htb    admirer.htb    cache.htb    travel.htb    dyplesher.htb    blunder.htb    blackfield.htb    fuse.htb    tabby.htb


A simple bash script to grab open ports with nmap and then scan just those open ports more aggressively:

echo Grabbing ports...
ports=$(nmap -p- --min-rate 1000 -T4 $1 | grep ^[0-9] | cut -d '/' -f 1 | tr '\n' ',' | sed s/,$//)  
echo Ports grabbed!
echo Scanning...
nmap -sC -sV -Pn -p $ports $1 $2 $3


portscan -oX nmap.xml

Hack The Box