Category Archives: Linux

All things linux

TCPDUMP with Date for Wireshark

Just another handy snippet:

It will date the output, and also put it in a handy pcap for Wireshark.

tcpdump -i eth1 -s0 -v -w /tmp/capture_`date +%d_%m_%Y__%H_%I_%S`.pcap

*Note: Should work on all Linux distros (make sure to have the right network interface selected, Ex: eth1); it might have to be slightly modified for Mac. Windows can go DIAF.

 

Search entire server for Q4 2015 obfuscated PHP malware of unknown origin.

This is just a snippet I have used before to identify some malicious code on web servers.  This will not work on everything; but it will give you a way to find suspect files.  It is easy to cron in a script with others to make a nice daily report if you have those concerns.

#!/bin/bash
# Malware Search Script
# 11/1/15 – Matthew D. Curry
# Matt@MattCurry.com

echo “Search entire server for Q4 2015 obfuscated PHP malware of unknown origin.”

find / -name *.php -exec grep -Hn .1.=…….0.=…….3.=…….2.=…….5.= {} ;

 

Hope this helps, enjoy.

Remove Spaces (or any character) from File Names in Linux

This is actually a pretty common thing to run into in a Linux file system.  It is especially prevalent in the files that are moved from another operating system (Usually Windows).  So if you get files that need to have a space or a character removed, the below snipped is a very simple, and handy way to fix this issue.

└─(11:26:40)-(~/Example)->ls
file 1.txt
file – 2.txt

So, from here we want to rename the file “file 1.txt” to “file_1.txt”.  This would be done as follows:

rename ‘s/ /_/g’ file 1.txt

This will remove any spaces in the file-name listed.  If you want to do all the files in a directory:

rename ‘s/ /_/g’ *

Here is an example output if we run it on all the files in the directory (as seen above):

└─(11:33:59)-(~/Example)->ls
file_1.txt
file_-_2.txt

 

Note:  If you are new to Linux; and you haven’t heard of the “sed” command, that is the syntax used in the command.  If you get comfortable with this, then you can easily learn sed, which is a great tool to have on the command line.

Want to use DNF? What to expect…

DNF actually DOES stand for something… Not sure where that started.

DNF stands for Dandified yum

DNF started showing up in Fedora 18, and Fedora 20 was the first Linux distro that welcomed users to utilize  DNF in place of YUM.

The technical challenges of DNF are that there is little or no support for features:

  • Debug
  • Verbose output
  • Enable Repository
  • Exclude packages during install
  • No effect of –skip-broken switch
  • The command resolvedep unavailable
  • The option skip_if_unavailable is ON by default
  • Dependency resolving process is not visible in Command Line
  • Parallel downloads in future release
  • Undo History
  • Delta RPM
  • Bash completion
  • Auto-remove
  • many others…

 

In short, if you drink the cool-aid then you should run this in a lab only.  I know people that try to run this stuff in production.  You are just asking for a serious problem. Other than that, I hope it gets there, DNF is just too new.

If you use Microsoft, you get what you deserve…

…only if you read this and keep using it…

🙂

     If you use Microsoft, it doesn’t make you dumb. We all know its the most popular, and shoved down your throat by the $2,000,000,000 they spend a year trying to sway your opinion.  Not to mention the bullying tactics I have seen first hand in the B2B space.

Keep in mind I am not talking solely about privacy as seen in the picture below.  However, that alone should be enough for any business to stop using them immediately.  Most companies are afraid of change, because it usually costs money. Although, if you truly calculate the costs of running Microsoft as an OS you will see that it is much higher.  Not only is it fiscally irresponsible (not to mention ethically/morally), but if you are a software company; or one that relies on it heavily.  You will find that the completely horrid security of windows makes it a great target.  Combine that with uneducated users and you get the hackers favorite playground.

You may have noticed that I haven’t mentioned performance comparisons.  Thats because windows doesn’t even come close to the stability and speed of Linux/BSD.  Here is an experiment for you Windows users.  Try turning it on, and not doing anything and let it run for a month straight.  Then make note of when it crashes (because it will).  Then do the same with a vanilla Linux install. I turned my last laptop off after 376 days of uptime.

Microsoft

The Nightmare of Azkaban with Hive (Hadoop)

I have been working on a deployment of Azkaban for about a week now; and getting the server up and running was easy.  However I have had many major issues with Azkaban since day one.  I feel like sharing this could help someone else if they decide to use it.

Pros:

  • It has dependency flows that are easy to use.
  • ACLs
  • Pretty Graphs
  • Scheduling (Kinda its purpose)
  • Good API

Cons:

  • Hive/Pig and Possibly other Jobtypes simply do not work.
    • After many hours of searching I found there is a bug in the jobtypes plugin, and it has not been fixed.
      • You must completely recompile with the newer version to have these job types work.
    • The Newest version of Azkaban is no where close to the version they have on their site.
      • This also is not compiled, you will have to do it manually.
    • The Documentation is full of errors, bad links, and omissions (at best).
      • Not to mention it is all for 2.5, when 3.x is out.
      • SSL Keystore Doc Links are all bad (major setup step).
    • No Packages for YUM/APT/ZYPPER/etc
      • I would have thought someone would have done this by now
        • I created some using FPM
    • No INIT script built. (Azkaban Init Script)

So, in closing as you can see the project has good intentions but that’s about it.  Its not ready for prime time, and they really need to get their stuff together.  If it were cleaned up and recompiled, and packaged.  It would probably be an OK product. However, the lack of organization and communication will be what prevent me from recommending this for any of my personal customers going forward.  I hope this helps anyone considering this product.

 

Sincerely,
Matthew Curry

Your Favorite IDE/Editor (GUI)

I have tried many editors in Linux, Mac, and even Winblows.  However, none of them like this…  Please take a look at this video and you will be surprised at the customization that is possible with this editor.  No matter your language, theme, or plugin preferences.  It also has its own package manger to mange all the awesomeness so you dont get corn-fused…

 

 

SysAdmin Day

desk-sysadmin-day

 

Everyone post your SysAdmin desktops to show support!  If it weren’t for your local systems administrator you would likely not be using a computer right now.  These guys are the hard working backbone of any IT department.  These unsung heroes go unnoticed in their back offices until something breaks…