<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.fortier-family.com/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>Warnaud&#039;s Wiki - scripting:bash</title>
        <description></description>
        <link>https://wiki.fortier-family.com/</link>
        <lastBuildDate>Tue, 28 Apr 2026 17:23:32 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://wiki.fortier-family.com/_media/wiki/logo.png</url>
            <title>Warnaud&#039;s Wiki</title>
            <link>https://wiki.fortier-family.com/</link>
        </image>
        <item>
            <title>chaosreader</title>
            <link>https://wiki.fortier-family.com/scripting/bash/chaosreader</link>
            <description>url=&quot;&quot;;for file in `ls -S1 | head -10`; do url=&quot;https://www.virustotal.com/gui/file/`shasum $file | cut -d &quot; &quot; -f1` $url&quot; ; done; firefox $url&amp;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 03 Nov 2021 16:15:56 +0000</pubDate>
        </item>
        <item>
            <title>cleaning</title>
            <link>https://wiki.fortier-family.com/scripting/bash/cleaning</link>
            <description>Cleaning

Developpers took years to develop a very NOT usefull feature: copy/paste with formatting ( by default !)
To clean script where outputs is “hallucinating” like:


# ./script.sh
./script.sh: line 1: !#/bin/bash: No such file or directory</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 15 Jun 2023 06:36:31 +0000</pubDate>
        </item>
        <item>
            <title>dnssynchro</title>
            <link>https://wiki.fortier-family.com/scripting/bash/dnssynchro</link>
            <description>To check if the same host has the same resolution on several different DNS (from /etc/resolv.conf) on the same machine:

for dns in `sed -n &#039;s/^nameserver //p&#039; /etc/resolv.conf`; do host -s thehost.toveri.fy $dns | awk &#039;/has address/ {print $4}&#039; &gt; $dns ; done; diff `sed -n &#039;s/^nameserver //p&#039; /etc/resolv.conf` &gt; /dev/null; if [ `echo $?` != 0 ]; then date ; grep [0-9] `sed -n &#039;s/^nameserver //p&#039; /etc/resolv.conf`; fi</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 17 Dec 2020 04:23:57 +0000</pubDate>
        </item>
        <item>
            <title>exitcode</title>
            <link>https://wiki.fortier-family.com/scripting/bash/exitcode</link>
            <description>When you want to check/validate that a command ran fine, you need to recuperate its exit code.

Again several ways:

	*  Easy: 
 command
returnvalue=$?

	*  All at once:
returnvalue=$(command)$?</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 17 Dec 2020 04:23:57 +0000</pubDate>
        </item>
        <item>
            <title>find</title>
            <link>https://wiki.fortier-family.com/scripting/bash/find</link>
            <description>Reference

	*  &lt;https://sysaix.com/43-practical-examples-of-linux-find-command&gt;

file

find . -name file.txt

file in specific dir

find /var -name file.txt

file with part of the name

 find /var -iname file.txt

/var/file.txt
/var/File.txt
/var/FILE.TXT
/var/FiLe.TxT

Find Directories Using Name

Find all directories whose name is Emre in /home directory.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 22 Aug 2023 09:18:18 +0000</pubDate>
        </item>
        <item>
            <title>history</title>
            <link>https://wiki.fortier-family.com/scripting/bash/history</link>
            <description>History command

by default returns an history of latest command ran on this login

it is ~the latest “HISTSIZE” commands. it can differ with the options of HISTCONTROL (for example ignoredups which ignore duplicates)

remove the number

history | cut -d &#039; &#039; -f 4-</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 12 May 2023 08:57:52 +0000</pubDate>
        </item>
        <item>
            <title>hosts</title>
            <link>https://wiki.fortier-family.com/scripting/bash/hosts</link>
            <description>I always want to get rid of the sh*tload of ads/spywares/analitics/&lt;your name it&gt; crap downloaded by your browser.

I have a solution on the DNS with Bind (using only one url to get an hosts file) see DNS on Raspberry Pi and DNS on OpenBSD.

I now use 2 DNS at home. One running Bind with default config. Another running dnsmasq for my home dns entry and the ease to add all those funky domain to hell.</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 29 Dec 2021 20:03:38 +0000</pubDate>
        </item>
        <item>
            <title>returnvar</title>
            <link>https://wiki.fortier-family.com/scripting/bash/returnvar</link>
            <description>When you want to save values between functions of your bash script, there are several ways:

	*  Use the same variable name and don&#039;t create them as “local” to a function 
function myfunc()
{
    myresult=&#039;some value&#039;
}

myfunc
echo $myresult

 :!:</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 17 Dec 2020 04:23:57 +0000</pubDate>
        </item>
        <item>
            <title>volatility-check</title>
            <link>https://wiki.fortier-family.com/scripting/bash/volatility-check</link>
            <description>Script which uses volatility 2.x + yara rules to extract tons of useful info


#!/bin/bash

# check if we have at least one file
if [ $# -eq 0 ]
  then
    echo &quot;No memory dump supplied&quot;
    exit 0
fi
DUMP=$1


# check if it exists
if test -f &quot;$DUMP&quot;; then
    echo &quot;Starting volatility analysis of $DUMP&quot;
else
    echo &quot;$DUMP doesn&#039;t exist&quot;
    exit 0    
fi
# Displays the step and add nice separations in the report
function title(){
	#echo -e &quot;\n&quot;
	#printf &quot;[INFO] Extracting $1&quot;
	echo &quot;[INFO] Ex…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 29 Dec 2021 20:13:34 +0000</pubDate>
        </item>
    </channel>
</rss>
