How do I clean messages out of a rocketchat room or channel?

Posted Leave a comment

Trimming RocketChat

This functionality was added to newer versions of rocketchat, this same way WILL work, but it’s easier to do it in the room interface.

We switched from a paid slack account last year, to rocketchat.

I’ve written bots in the past to alert coworkers of system issues in a more public place, but some of my rooms were getting upwards of 10,000 messages and the browser and phones would be extremely slow pulling the room up as message counts were growing.

Sending messages to a chat in a controlled manor is a great way to alert a lot of people to issues, or log something. This should make it super easy to clean the rooms out when they grow larger than you thought they would!

python to the rescue!

My client can do the following:

  1. test connection to server (–whoami)
  2. send a message to a user. (–send –user justin –text “hi there!”)
  3. send a message to a group. (–send –group groupname –text “Hi there!”)
  4. send a message to a channel. (–send –channel channelname –text “Hi there!”
  5. delete all messages in a group. (–delete –group roomname –iknow)
  6. delete all messages in a channel. (–delete –channel roomname –iknow)
  7. install saved rocketchat credentials. (–install –rcuser user –rcpass pass –rchost hostname)
  8. spam a group with test messages (–trash –iknow –group groupname)
  9. spam a channel with test messages (–trash –iknow –channel channelname)

What are these groups and channels?

On rocketchat it gets a little confusing sometimes. If you have a room, where everyone is allowed to view and post, it’s considered a “channel”.

If you have a private channel, it’s considered a “group”.

Cosmicray-rocketchat

I found a newer api, as my last client was using rocket-python, which didnt seem to allow me to delete messages in a somewhat controlled manor.

The api can be installed like so

to use the software paste the following in a file, name it rc-client.py

you might want to install python3:

it’s in the repo for centos, and fedora, and pretty much any operating system, since I use rpm based distros, these instructions are for CentOS.

once saved, use the following examples:

first install example:

delete messages from channel:

delete messages from room:

send a message to a group:

send a message to a channel:

send a message to a user:

fill a channel with test messages:

file a group with test messages:

Signing windows applications from linux

Posted Leave a comment

We’re starting to sign some custom code, and I was looking for a quick and easy way to sign from Linux, since only one of our dev’s use windows most of the time I needed a snazzy/easy way to sign from Linux workstations.

I’ll drop this here for everyone since I spent a TON of time researching and trying it the mono way with signcode, and failed miserably every time I tried it. osslsigncode works extremely well.

Install osslsigncode using yum or apt:
sudo apt-get install osslsigncode
sudo yum install osslsigncode
For our purpose, we will use a self signed key, to generate:
openssl req -x509 -newkey rsa:4096 -keyout key-hotlines.pem -out cert-hotlines.pem -days 365
Now, to sign the executable:
osslsigncode sign -certs "cert.pem" -key "key.pem" -pass "PaSSw0Rd1!" -n "MyApp 1.2" -i "https://www.mysite.com" -t "http://timestamp.comodoca.com/authenticode" -in "app.exe" -out "signed-app.exe"  
What it all means
osslsigncode = signing application  
"sign" = tells osslsigncode to sign
-certs = certificate file
-key = key file
-pass = decryption key you set on the certificate
-n = application name
-i = site address
-t = timestamp
-in = compiled, non signed executable
-our = signed executable
Verification:

Verification is easy!

osslsigncode verify signed-app.exe

should end with a certificate dump and succeeded if all goes well and it’s signed, or “No Signature Found” if the application is not signed. Be careful, even if you are unable to see signatures, the command still ends with Succeeded.

Should I do an EV/OV Signing cert?

We plan on getting a valid certificate soon, as a self-signed cert will work given enough time, but an EV cert will be trusted by windows smart screen immediately. If you do a self signed, expect needing hundreds of installs before your software can be trusted on Windows. A signing cert can be had for $200(OV) to $300(EV).

In closing…

How do you guys sign your code? I tried a few different ways and it always failed miserably! But this seems to work perfectly, so I’m sticking it in my site for when I need it again.