<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>#!/bin/bash</title>
	<atom:link href="http://binslashbash.org/feed/" rel="self" type="application/rss+xml" />
	<link>https://binslashbash.org</link>
	<description>The ranting of a developer / curious tinkerer sprinkled with free software.</description>
	<lastBuildDate>Sat, 11 Aug 2018 16:24:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.9.8</generator>
	<item>
		<title>File Shredding</title>
		<link>https://binslashbash.org/2018/08/11/file-shredding/</link>
		<comments>https://binslashbash.org/2018/08/11/file-shredding/#respond</comments>
		<pubDate>Sat, 11 Aug 2018 16:24:39 +0000</pubDate>
		<dc:creator><![CDATA[jnewing]]></dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">https://binslashbash.org/?p=39</guid>
		<description><![CDATA[A neat little class in C# that allows for secure file deletion. What I  mean is a way to shred a file on your PC essentially. It takes the space the file had occupied then overwrites it with random data as many times as you like. I had done up a nice console app that...]]></description>
				<content:encoded><![CDATA[<p>A neat little class in C# that allows for secure file deletion. What I  mean is a way to shred a file on your PC essentially. It takes the space the file had occupied then overwrites it with random data as many times as you like. I had done up a nice console app that let users access this via command line.</p>
<p>Perhaps I&#8217;ll post that, however for now here is the class that does the work.</p><pre class="crayon-plain-tag">using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Security.Cryptography;

namespace SecureDelete
{
    public class Delete
    {
        public void deleteFile(string filename, int totalPasses = 2)
        {
            try
            {
                if (File.Exists(filename))
                {
                    // RNG
                    RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
                    
                    // init our dummy sector buffer
                    byte[] buffer = new byte[512];

                    // can we read / write the file?
                    File.SetAttributes(filename, FileAttributes.Normal);

                    // calculate our file sectors
                    double totalSectors = Math.Ceiling(new FileInfo(filename).Length / 512.0);

                    // open the file
                    FileStream inputStream = new FileStream(filename, FileMode.Open);
                    
                    // write with random data
                    for (int currentPass = 0; currentPass &lt; totalPasses; currentPass++)
                    {
                        // update the pass info
                        UpdatePassInfo(currentPass + 1, totalPasses);

                        // align to start of file
                        inputStream.Position = 0;

                        // loop all sectors
                        for (int sectorsWritten = 0; sectorsWritten &lt; totalSectors; sectorsWritten++)
                        {
                            // update sector info
                            UpdateSectorInfo(sectorsWritten + 1, (int)totalSectors);

                            // fill buffer with random data
                            rng.GetBytes(buffer);

                            // write it to file
                            inputStream.Write(buffer, 0, buffer.Length);
                        }
                    }

                    // added
                    inputStream.SetLength(0);

                    // close input
                    inputStream.Close();

                    // value added
                    DateTime d = new DateTime(2099, 1, 1, 1, 1, 0);
                    DateTime dt = new DateTime(2037, 1, 1, 0, 0, 0);
                    File.SetCreationTime(filename, dt);
                    File.SetLastAccessTime(filename, dt);
                    File.SetLastWriteTime(filename, dt);

                    File.SetCreationTimeUtc(filename, dt);
                    File.SetLastAccessTimeUtc(filename, dt);
                    File.SetLastWriteTimeUtc(filename, dt);
                    
                    // delete the file
                    File.Delete(filename);

                    // call the done event
                    DeleteDone();
                }
            }
            catch(Exception e)
            {
                DeleteError(e);
            }
        }

    #region Events 
        
        public event PassInfoEventHandler PassInfoEvent;

        private void UpdatePassInfo(int currentPass, int totalPasses)
        {
            PassInfoEvent(new PassInfoEventArgs(currentPass, totalPasses));
        }

        public event SectorInfoEventHandler SectorInfoEvent;
        private void UpdateSectorInfo(int currentSector, int totalSectors)
        {
            SectorInfoEvent(new SectorInfoEventArgs(currentSector, totalSectors));
        }

        public event DeleteDoneEventHandler DeleteDoneEvent;
        private void DeleteDone()
        {
            DeleteDoneEvent(new DeleteDoneEventArgs());
        }

        public event DeleteErrorEventHandler DeleteErrorEvent;
        private void DeleteError(Exception e)
        {
            DeleteErrorEvent(new DeleteErrorEventArgs(e));
        }

    #endregion

    #region PassInfo

        public delegate void PassInfoEventHandler(PassInfoEventArgs e);
        
        public class PassInfoEventArgs : EventArgs
        {
            private readonly int cPass;
            private readonly int tPass;

            public PassInfoEventArgs(int currentPass, int totalPasses)
            {
                cPass = currentPass;
                tPass = totalPasses;
            }

            public int CurrentPass { get { return cPass; } }

            public int TotalPasses { get { return tPass; } }
        }

    #endregion

    #region SectorInfo
    
        public delegate void SectorInfoEventHandler(SectorInfoEventArgs e);
        
        public class SectorInfoEventArgs : EventArgs
        {
            private readonly int cSector;
            private readonly int tSectors;

            public SectorInfoEventArgs(int currentSector, int totalSectors)
            {
                cSector = currentSector;
                tSectors = totalSectors;
            }

            public int CurrentSector { get { return cSector; } }

            public int TotalSectors { get { return tSectors; } }
        }

    #endregion

    #region DeleteDone

        public delegate void DeleteDoneEventHandler(DeleteDoneEventArgs e);
        
        public class DeleteDoneEventArgs : EventArgs { }
        
    #endregion

    #region DeleteError

        public delegate void DeleteErrorEventHandler(DeleteErrorEventArgs e);
        
        public class DeleteErrorEventArgs : EventArgs
        {
            private readonly Exception e;

            public DeleteErrorEventArgs(Exception error) { e = error; }

            public Exception WipeError { get { return e; } }
        }

    #endregion

    }
}</pre><p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://binslashbash.org/2018/08/11/file-shredding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xDEC &#8211; Decrypt Xshell Passwords</title>
		<link>https://binslashbash.org/2018/06/06/xdec-decrypt-xshell-passwords/</link>
		<comments>https://binslashbash.org/2018/06/06/xdec-decrypt-xshell-passwords/#respond</comments>
		<pubDate>Wed, 06 Jun 2018 18:35:35 +0000</pubDate>
		<dc:creator><![CDATA[jnewing]]></dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">https://binslashbash.org/?p=16</guid>
		<description><![CDATA[I had a client that needed passwords recovered that they had stored within an application called Xshell. Xshell is an SSH client for Windows. So after I had done this I went about creating a small command line utility for just this purpose. This has been tested on Xshell v5, after a quick look, it...]]></description>
				<content:encoded><![CDATA[<p>I had a client that needed passwords recovered that they had stored within an application called Xshell. Xshell is an SSH client for Windows. So after I had done this I went about creating a small command line utility for just this purpose.</p>
<p>This has been tested on Xshell v5, after a quick look, it appears that version 6 is now available and I have no idea if this will work on the newer version. Regardless here is the app for download.</p>
<p>Binaries: <p><a class="aligncenter download-button" href="https://binslashbash.org/download/13/" rel="nofollow">
		Download &ldquo;xDEC v1.0&rdquo;		<small>xdec.v1.0.zip &ndash; Downloaded 88 times &ndash; 40 KB</small>
	</a></p></p>
<p>Source: <p><a class="aligncenter download-button" href="https://binslashbash.org/download/18/" rel="nofollow">
		Download &ldquo;xDEC v1.0 Src&rdquo;		<small>xdec.v1.src_.zip &ndash; Downloaded 68 times &ndash; 50 KB</small>
	</a></p></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>https://binslashbash.org/2018/06/06/xdec-decrypt-xshell-passwords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welp, here we go again.</title>
		<link>https://binslashbash.org/2018/06/03/welp-here-we-go-again/</link>
		<comments>https://binslashbash.org/2018/06/03/welp-here-we-go-again/#respond</comments>
		<pubDate>Sun, 03 Jun 2018 18:03:26 +0000</pubDate>
		<dc:creator><![CDATA[jnewing]]></dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">https://binslashbash.org/?p=10</guid>
		<description><![CDATA[I know, I&#8217;ve done this before in the past, and while I&#8217;m definitely not the most consistent poster, blogger, whatever, I still find myself needing a place to publish my random software bits. Also, a place for me to post findings, papers and other tidbits about reverse engineering and other projects I undertake. So I...]]></description>
				<content:encoded><![CDATA[<p>I know, I&#8217;ve done this before in the past, and while I&#8217;m definitely not the most consistent poster, blogger, whatever, I still find myself needing a place to publish my random software bits. Also, a place for me to post findings, papers and other tidbits about reverse engineering and other projects I undertake.</p>
<p>So I will be posting stuff I here and hopefully keeping it&#8230; somewhat&#8230; updated.</p>
]]></content:encoded>
			<wfw:commentRss>https://binslashbash.org/2018/06/03/welp-here-we-go-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
