Pastebin – Digital Paper Scraps

Having a place to put snippets of code, logs for Linux, and output I might need only once in a blue moon is helpful. In lieu of saving text files in a directory tree, having the content in a database makes searching easier.

There is a public service Pastebin which touts “#1 paste tool since 2002!”. I have an account at Pastebin and use it extensively to share with other developers various logs &etc. which can sometimes be 100k or more of lines, but contain one or two critical lines. Context is everything, so while a single line may be causing the problem, how we got there is important to know. Thus, having a huge complete log is necessary to troubleshoot a problem.

Here is a screenshot from my public Pastebin page.

Source: https://pastebin.com/VubC5XRN

While Pastebin offers the ability to share public URLs, URLs not published (“private”), and password protected URLs, I’d like to know that my own pastes which are for my eyes only are not on some remote server that will eventually get compromised. So, I found an open source project, Stikked, which mimics the basics of a pastebin server. I installed Stikked on one of my internal servers, ares, which is limited to my network only — it is not accessible from the Internet.

Stikked is hosted on Github which is a public repository now owned by Microsoft which allows people to share open source code. Stikked was abandoned about 5 years ago. So what I did is “fork” the project to my own Github account and then I have modified the code to keep it compliant with updates from the ever-evolving PHP.

What is really sweet is that I can be in a shell and pipe the output I want to save directly to my pastebin server. Here’s an example:

produces:

Here’s the simple URL returned to my console (which will not work for you) http://ares/paste/view/f54ed115

Lastly, what is really helpful is that all the text of a pasted item is stored in a database, so I can visit my paste bin server and perform a search, e.g. for the term “xen”, and all the pastes I have stored containing that term appear. This makes finding the needle in a haystack easier and, most importantly, it is not on someone else’s server that will be a target for hackers.

For Gentoo users: the versions of PHP & Apache as of April 26, 2024, where I run my fork of Stikked is on this public paste.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *