Published writing

Blog

Browse recent posts, filter by category, and move through the archive five posts at a time.

32 posts

Installing NGINX on Docker

Installing NGINX on Docker

What is Docker?

Docker provides the capability to package a utility and its dependencies in a file that is called a container. Containers can be easily installed and ran on other machines without having to worry about differences between their machine and yours. This also bring the benefit of allowing more apps to run on a single server since the dependencies for the utility are contained in the container.

The Dockerfile

Dockerfiles are text files that tell the Docker tool how to build the image. The files could contain the commands to install and configure Nginx for example.

Setting up the Dockerfile

We first specify what we want to base our image off of, which the first line From ubuntu, specifies. This tells the Docker system to use the base Ubuntu image from Dockerhub. It will download the base Ubuntu image and layer the following commands on top of the base image.

From ubuntu

The next thing that we will want to

Read full post

Learning RUST by creating a basic C2!

Learning RUST by creating a basic C2!

The first that that I programmed in Rust was before version 1 was released. Rust is currently sitting at version 1.46. I wanted a quick project to review the language in the current form. The project I decided on was to write a very basic C2.

The code below launches a TCP stream that connects to a netcat session and starts a command session that redirects the STDIO and STDERR streams.

This project allowed great insight into how threading worked in Rust. Below is the code that I ended up with. Again, this is very basic and the structure could be cleaned up.

#![allow(unused)]

#[macro_use]
extern crate lazy_static;

use std::process::ChildStdin;
use std::process::Command;

use std::io::Write;
use std::process::Stdio;
use std::str;
use std::io::{BufRead, BufReader, BufWriter};
use std::thread;
use std::time;
use std::io::Read;
use std::sync::{Arc, Mutex};
use std::io::{stdin,stdout};

use std::net::TcpStream;
use std::io::prelude::*;
use tokio::io::split;

struct tcpStructure {
 
Read full post

Custom Authentication Handler .Net Core

Custom Authentication Handler .Net Core

The MVC framework for c# has a nice authentication and authorization framework that covers almost all use cases that there are currently. But what if there is an authentication method that you need that it currently does not support?

Custom Authentication handlers are your answers as it can build on top of the current framework. In this document I will go over the very basics of creating a custom authentication handler in C# .Net Core 3.

Creating The Project

Lets start by creating new project in Visual Studio using the ASP.NET Core Web Application template.

Create a new ASP.NET Core Web Application.

Name the project. In this example I decided to name it CustomHandlerTest. On the next s

Read full post

Printing PDF to Multiple Printers

Printing PDF to Multiple Printers

There was a request to be able to print a PDF document to several printers with minimal work. I have worked on projects that utilized c# that received input from other systems to work behind the scenes with no user intervention. This task was slightly different as the PDF was manually being created. After some research in the Acrobat Reader documentation, it appears that the AcroRd32.exe executable accepts parameters to specify that you would like a document to be printed.

It was decided that utilizing a batch script would be the easiest route. The batch script accepts the location of a PDF file and passes the file into a command that specifies the filename and printer. Below code is an example of the batch file.

SET file=[Path To PDF File]

"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" /t %file% "[PrinterName]1"

"C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" /t %file% "[PrinterName]2"
Read full post