Quick Fire Character Counting Game In PowerShell

Another pointless activity in PowerShell. The premis of this game is that you have a short amount of time to look at a word, you then have to guess how many letters are in the word.

If you get the number correct, the game continues and your score increases. If you input and incorrect number, then the game ends, shows your score and exits.

As always I have added this to my “Games In PowerShell” project. Below is the code for the game:

function quickfirecounting{
 $getverbs = Get-Verb | select verb
 [int]$verbamount = $getverbs.count
 $scoreforquickfire = 0
 do{
  $random = Get-Random -Minimum 0 -Maximum $verbamount
  $selectedword = $getverbs[$random] -replace "@{verb=","" -replace "}",""
  $selectedwordlength = $selectedword.Length

  $scoreforquickfire = $scoreforquickfire + 1
  Clear-Host
  Write-Host "$selectedword"
  Start-Sleep -Milliseconds 550
  Clear-Host
  $guess = Read-Host "how many letters are in the word?"
 }until ($guess -ne $selectedwordlength)
 Clear-Host
 Write-Host "Incorrect! There were $selectedwordlength letters"
 Start-Sleep -Seconds 1
 Clear-Host
 Write-Host "Your score was $scoreforquickfire"
 Start-Sleep -Seconds 1
 Clear-Host

 do {$playagainselection = Read-Host "do you want to play again? (Y or N)"} while (("y","n") -notcontains $playagainselection)
 if ($playagainselection -eq "y"){
  ####GO TO GAME FUNCTION TO PLAY AGAIN####
 }elseif ($playagainselection -eq "n"){
  ####GO TO THE MAIN MENU####
 }
}

As you can probably see, I am using the verb section of PowerShell to get the random words. This is better and easier than inputting my own words individually.

Enjoy!

Customized Email Signatures In HTML

Back off holiday, want to do something simple. So email signature it is.

I made mine in the Mimecast administrator center as a way to become more familiar with HTML so that I could create an actual signature for some users.

Before we look at the code – I will put an image below of what the signature would actually look like. Also, I own NONE of the images/sites shown here. (Sorry, just didn’t want legal people sniffing around).

Signature

Now that you have seen the signature, you can see that is it in no way a real world example of something that should be used. But I also couldn’t use the actual one for…reasons. I just wanted to show you every feature I used in the real one.

Below is the actual code I used:

<html>
 <head>
 </head>
  <body><mc type="body">
  <p style="font-family:calibri:">This is a <b>test</b> email signature</p>

  <img src="http://combiboilersleeds.com/images/test/test-5.jpeg" alt="TEST LEFT" style="float:left;width:50px;height:20px;" />
  <p style="font-family:courier;">This is the second line of the test email signature</p>
  <p style="font-family:verdana;font-size:80%;">This is the last line of the test email signature</p>

  <img src="http://combiboilersleeds.com/images/test/test-5.jpeg" alt="TEST IMAGE" style="width:200px;height:70px;" />

  Click <a href="https://krebsonsecurity.com/" target="_blank"><i>here</i></a> to open a link

 </body>
</html>

You may notice that I have linked Krebs blog – Enjoy!

Adding Signatures In Mimecast

Bit different from, the now usual, Powershell guides. Thought I’d do something different. This guide will show you how to add a custom signature to a user, multiple users’ or even globally.

Lets start off. You’ll want to log into your Mimecast administrative console, go to Service-Gateway-Policies. In here you should see “Stationary”. We want to create a new definition, so click on the “Definition” button on the “Stationary” listing.

Here you can click the “New Item” button. For the Description, obviously, enter a brief description of the new definition. The “Unique Identification Text” is used to scan an email that the definition is applied to to determine if the signature has already been added, so you want to add something that is in the signature and something that is unique to this signature. For the short code, enter a unique name. Below is an example of mine:

1

Now we want to edit the HTML so that there actually is a signature to put onto the emails. Click on the “Edit HTML” button and enter your signature. This is the code I added to mine:

<html>
 <head>
 </head>
  <body>
    <mc type="body">

    <font size="2" color="gray">
    This is a test email signature for marketing
    </font>

    <img src="IMAGE LINK" alt="ALTERNATIVE IMAGE NAME" style="width:214px;height:24px:" />

 </body>
</html>

So in my signature I have the message “This is a test email signature for marketing” and also a company logo.

Now we have that, we need to add it to an actual policy, otherwise it simply won’t be used by anything. Navigate back after saving your definition to the “Policies” page and click on the “Stationary” row. You now want to click “New Policy” which should open up a new policy creation window.

For the “Policy Narrative” enter a name for the policy, for the “Select Stationary”, select “lookup”, find your newly created definition and click “Select”. Since I created mine as a test and my Mimecast access is on my business email address, I configured an individual send and to email address for the policy to apply to. On this page you can also select when the policy will be active or even a range of source IP addresses.

Below are the values that I entered. The emails are removed for obvious reasons:

2

Finally, below is an example of an email with the newly added signature:

3

You should now have a custom signature that applies to every user defined in the policy instead of individual users.