Где это я?

Что это за сайт, спросите вы?

Это личный блог Михаила Романова (c 1998 года известного, как 891rpm).

Если вы зашли сюда по ссылке с какого-то сайта, значит я имел отношению к этому сайту и могу вам чем-то помочь, не только в техническом, но и, возможно, в другом плане. Пишите или на мой email или в разделе связь со мной.

Если вы не являетесь разработчиком или системным администратором, то вас могут заинтересовать только мои контактные данные.

Для тех людей, кто со мной работает, можно увидеть расписание работы и детальную отчетность на страничке Расписание (дополнительно нужно будет зайти в свой аккаунт Google и запросить у меня доступ к соответствующему календарю).

Если мы с вами уже работаем и вы хотите внести вознаграждение за работу, то различные способы оплаты можно найти на соответствующей странице.

Для работодателей и соискателей ответственного и высокопрофессионального работника, есть страничка, под названием Работа.

На картинке, кстати, изображен одноименный со мной тахометр 🙂

How to monitor traffic at Cisco router using Netflow

By default Cisco IOS doesn’t provide any traffic monitoring tools like iftop or iptraff available in Linux. While there are lots of proprietary solutions for this purpose including Cisco Netflow Collection, you are free to choose nfdump and nfsen open source software to monitor traffic of one or many Cisco routers and get detailed monitoring data through your Linux command line or as graphs at absolutely no cost.

Below is beginner’s guide that helps to quickly deploy netflow collector and visualizer under Linux and impress everybody by cute and descriptive graphs like these:

It is highly recommended to look through Netflow basics to get brief understanding of how it works before configuring anything. For example, here is Cisco’s document that gives complete information about Netflow. In a few words to get started you should enable netflow exporting on Cisco router and point it to netflow collector running under Linux. Exported data will contain complete information about all packets the router has received/sent so nfdump and nfsen working under Linux will collect it and visualize to present you the graph like above example.

Cisco Router Setup

1. Enable flow export on ALL Cisco router’s interfaces that send and receive some traffic, here is an example:

2. Setup netflow export:

Where 1.1.1.1 is IP address of Linux host where you plan to collect and analyze netflow data. 23456 is port number of netflow collector running on Linux.

Linux Setup

1. Download and install nfdump.

2. Download and install nfsen.

It requires web server with php module and RRD so make sure you have the corresponding packages installed. I hope you’re running httpd with php already so below are rrd/perl related packages installation hints only.

Fedora/Centos/Redhat users should type this:

Ubuntu/Debian:

If you run some exotic Linux distribution just install everything that is related to rrd + perl.

At last, nfsen installation:

In order to continue you should edit file etc/nfsen.conf to specify where to install nfsen, web server’s username, its document root directory etc. That file is commented so there shouldn’t be serious problems with it.

One of the major sections of nfsen.conf is ‘Netflow sources’, it should contain exactly the same port number(s) you’ve configured Cisco with — recall ‘ip flow-export …’ line where we’ve specified port 23456. E.g.

Now it’s time to finish the installation:

In case of success you’ll see corresponding notification after which you will have to start nfsen daemon to get the ball rolling:

From this point nfdump started collecting netflow data exported by Cisco router and nfsen is hardly working to visualize it — just open web browser and go to http://linux_web_server/nfsen/nfsen.php to make sure. If you see empty graphs just wait for a while to let nfsen to collect enough data to visualize it.

That’s it!

RTMP сервер на Debian Linux

Установка

Затем устанавливаем дополнительные пакеты:


Установка Red5

Запускаем:

В результате увидим работающий сервер Red5 по адресу: http://localhost:5080

Если работает firewall, то добавляем порты:

В качестве плеера советую как вариант использовать video.js.

RainbowCrack

rainbowcrack

Собрал на днях полигон для прогона RainbowCrack «тестов».

Пока доступны алгоритмы: SHA1, MD5

Таблицы:

md5_mixalpha-numeric#1-8
(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789)
Вероятность подбора: 99.9%
127GB

md5_mixalpha-numeric#1-9
(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789)
Вероятность подбора: 96.8%
1009GB

md5_mixalpha-numeric-all-space#1-8
(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 )
Вероятность подбора: 99.9%
1049GB

sha1_mixalpha-numeric#1-8
(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789)
Вероятность подбора: 99.9%
127GB

sha1_mixalpha-numeric#1-9
(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789)
Вероятность подбора: 96.8%
690GB

 

Конфигурация железа в данной генерации:

Основной просчет ведется на 2-х GPU, но для тестов производительности доступен также вариант с прогоном на CPU.

 

Производительность для 1 хэша

В текущей конфигурации скорость вычислений доходит до:

8.96E+12 (Plaintexts per Second) на 2-х GPU GeForce GTX 680

9.21E+11 (Plaintexts per Second) при использовании CPU i7 4790.

Открыт ограниченный бесплатный 🙂 доступ по адресу: http://891rpm.com/rc/

0. [2016-01-20] Доступ предоставляется по запросу на странице сервиса.
1. [2016-01-20] Введено ограничение на количество одновременных запусков тестов.
2. [2016-01-26] Введено ограничение на обращение к сервису с одного IP.

В планах:

0. Добавить кириллицу в таблицы
1. Добавить алгоритмы RIPEMD-160 и MySQL SHA1

P.S. Front-End для сервиса (для своей тренировки) написан на Django.
Позже выложу исходники 🙂

Визуальное распознавание хэшей

john-to-crack-the-password

13-символьный хэш:

DES (UNIX)

 

16-символьный хэш:

MySQL

 

32-символьные хэши:

без соли: md5 или md5($md5)

с солью 2 символа: md5($salt.$pass)

с солью 3,30 символов: md5(md5($pass).$salt)

с солью 5,8 символов: md5(md5($salt).md5($pass))

с солью 16,32 символа: md5($pass.$salt)

 

40-символьные хэши:

MySQL 5

признак: верхний регистр символов

SHA-1

признак: нижний регистр символов

​SHA1($username.$pass)

признак: наличие 4-символьной соли, обязательно наличие имени пользователя (username)

 

Другие хэши:

MD5 (UNIX)

признак: наличие $1$ в начале хэша

MD5 (WordPress)

признак: наличие $P$B или $P$9 в начале хэша

MD5 (PHPBB3)

признак: наличие $H$7 или $H$9 в начале хэша

​MD5 (APR)

признак: наличие $apr1$ в начале хэша

​OpenBSD Blowfish

признак: наличие $2a$ в начале хэша

SHA-256 (UNIX)

признак: наличие $5$ в начале хэша

SHA-512 (UNIX)

признак: наличие $6$ в начале хэша

Adding ES7 Class Properties to an ES6 React Component

ECMAScript 6

I’ve been investigating React and Flux over the last three posts, but one thing really didn’t sit right with me. That one thing is the React PropTypes in an ES6 class. I had to do something like this:

It’s ES6 code, but the fact that I have to munge the class after it has been created did not sit well. I wanted the propTypes to be a part of the class – just like a class in just about every other language.

Fortunately, there is a current proposal for class properties in ES7 (or ES2016 or ES vNext). It’s not ratified yet and the proposal may change. The ES6 version (above) is ratified and perfectly valid code. Let’s look at what the alternate ES7 version would look like:

I like the aesthetics of this version much more than the ES6 version. The propTypes is in the right place.

The bad news: This doesn’t lint and it doesn’t compile.
The good news: We can fix that!

Linting

I use eslint for my linter. You can change the parser that eslint uses so that it uses babel just like the compiler stage. Anything that would go through the compiler will go through the linter as well. To do this I need another package –babel-eslint:

Then I need to adjust my .eslintrc file to use the new parser:

Linting will pass if you run eslint on that JSX file, or if you run gulp eslint from my tutorial code. If you introduce an error (say, removing the semi-color from the return statement), eslint will still catch that.

Transpiling

To fix the transpiling, I need to make changes to my task. Here is the new task:

Of course, you will put the requires at the top of your gulp file, and have extra stuff in the config and files objects. However, the task itself works. Note that I need to configure babelify to add in an optional configuration list that enables es7.classProperties. If your code uses one of the other optional experimental features, you can list those too.

Thanks to this, I can now convert all my React components to use the ES7 class properties syntax. I hope this proposal makes it in.

http://shellmonger.com/2015/08/21/adding-es7-class-properties-to-an-es6-react-component/

Настройка разрешения экрана в Linux

linux-resolution1. Используем cvt для вычисления параметров, которые будем использовать в xrandr:

Пример:

 

2. Используем параметры cvt в xrandr:

(Параметры Hsync и Vsync должны начинаться с заглавных букв).

 

3. Добавляем новый режим «2560×1440» в xrandr:

(Можно заменить Virtual1 на то, что нужно… Посмотреть можно командой xrandr)

 

4. Включить новый режим:

 

WGET. Лучшие практики использования

wget

Загрузка всех URL, указанных в файле FILE:


Скачивание файла в указанный каталог (-P):


Использование имя пользователя и пароля на FTP/HTTP:


Скачивание в фоновом режиме (-b):


Продолжить (-c continue) загрузку ранее не полностью загруженного файла:


Скачать страницу с глубиной следования 10, записывая протокол в файл log:


Скачать содержимое каталога http://example.org/~luzer/my-archive/ и всех его подкаталогов, при этом не поднимаясь по иерархии каталогов выше:


Для того, чтобы во всех скачанных страницах ссылки преобразовывались в относительные для локального просмотра, необходимо использовать ключ -k:


Также поддерживается идентификация на сервере:


Скопировать весь сайт целиком:


Скачивание галереи картинок с превьюшками.


Сохранить веб страницу (как она открывается локально) в текущую директорию


Продолжить скачивание частично скаченного файла


Скачать множество файлов в текущую директорию


Отображать вывод напрямую (на экран)


Скачать url в 01:00 в текущую директорию


Сделать закачку с уменьшенной скоростью В данном случае 20 КB/s


Проверить ссылки в файле


Оперативно обновлять локальную копию сайта (удобно использовать с cron)


Используем wildcard для того чтобы скачать несколько страниц


Запустить скачивание списка ссылок в 5 потоков


Проверить ссылки из файла на живость

Источники:

How To Install Grub Customizer 4.0.6 On Debian 8.0 Jessie

grub2Hello Linux Geeksters. As you may know, Grub Customizer is a nice application, that allows the user to edit the menu entries from the GRUB booting screen, set the default operating system, change the installed OS via a livecd.

The latest version available is Grub Customizer 4.0.6, which has has been released a while ago, bringing fixes.

In this article I will show you how to install Grub Customizer 4.0.6 on Debian 8.0 Jessie and derivative systems.

Because it is not available via repository, we have to download the deb packages from launchpad and install the via command-line. I prefer gdebi over dpkg due to the fact that it also handles dependencies.

Follow the instructions for your system’s architecture exactly, in order to get a successful installation.

How to install Grub Customizer 4.0.6 on 32 bit Debian 8.0 systems:

How to install Grub Customizer 4.0.6 on 64 bit Debian 8.0 systems:

Optional, to remove grub-customizer, do:

 

Simplifying your Django Frontend Tasks with Grunt

grunt-logoGrunt is a powerful task runner with an amazing assortment of plugins. It’s not limited to the frontend, but there are many frontend-oriented plugins that you can take advantage of to combine and minify your static media, compile sass and less files, watch for changes during development and reload your browser automatically, and much more.

In the last several years, the amount of tooling around frontend development has expanded dramatically. Frameworks, libraries, preprocessors and postprocessors, transpilers, template languages, module systems, and more! Wiring everything together has become a significant challenge, and a variety of build tools have emerged to help ease this burden. Grunt is the current leader because of its fantastic plugin community, and it contains a wide array of plugins that can be very valuable to a Django developer. Today I’m going to talk about an easy way to integrate Grunt with Django’s runserver, and highlight a few plugins to handle common frontend tasks that Django developers often deal with.

Installing Grunt

Grunt uses Node.js, so you’ll need to have that installed and configured on your system. This process will vary depending on your platform, but once it’s done you’ll need to install Grunt. From the documentation:

 

This will put the grunt command in your system path, allowing it to be run from any directory.

Note that installing grunt-cli does not install the Grunt task runner! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile. This allows multiple versions of Grunt to be installed on the same machine simultaneously.

Next, you’ll want to install the Grunt task runner locally, along with a few plugins that I’ll demonstrate:

 

Managing Grunt with runserver

There are a few different ways to get Grunt running alongside Django on your local development environment. The method I’ll focus on here is by extending the runserver command. To do this, create a gruntserver command inside one of your project’s apps. I commonly have a «core» app that I use for things like this. Create the «management/command» folders in your «myproject/apps/core/» directory (adjusting that path to your own preferred structure), and make sure to drop an __init__.py in both of them. Then create a «gruntserver.py» inside «command» to extend the built-in.

In your new «gruntserver.py» extend the built-in and override a few methods so that you can automatically manage the Grunt process:

 

A barebones grunt config

To get started with Grunt, you’ll need a barebones «Gruntfile.js» at the root of your project to serve as your config.

 

Combining static media

A common task for the frontend, and one that we often use complex apps for in Django, is combining and minifying static media. This can all be handled by Grunt if you like, avoiding difficulties sometimes encountered when using an integrated Django app.

To combine files, use the concat plugin. Add some configuration to the «grunt.initConfig» call, using the name of the task as the key for the configuration data:

 

This will combine all Javascript files under «myproject/static/app/js» into one file called «myproject/build/static/js/app.js». It will also combine all Javascript files under «myproject/static/vendor» into one file called «myproject/build/static/js/lib.js». You’ll likely want to refine this quite a bit to pick up only the files you want, and possibly build different bundles for different sections of your site. This will also work for CSS or any other type of file, though you may be using a preprocessor to combine your CSS and won’t need this.

You’ll probably want to use this along with the «watch» plugin for local development, but you’ll use the «uglify» plugin for deployment.

Minifying static media

Once your app is ready for production, you can use Grunt to minify the JavaScript with the uglify plugin. As with concatenation, minification of your CSS will likely be handled by your preprocessor.

This task should be run as part of your deploy process, or part of a pre-deploy build process. The uglify config will probably be very similar to your concat config:

 

The main difference is that uglify takes the new-style «files» option instead of the classic «src» and «dest» options that concat uses.

Compiling Sass

You can compile Sass with Compass using the compass plugin, but I prefer to use the speedier sass plugin that uses libsass. Here’s an example that includes the Foundation library:

 

Compiling Less

Less is compiled using the less plugin.

 

Watching for changes and live reloading

Now that you’ve got your initial operations configured, you can use the watch plugin to watch for changes and keep the files up to date. It also will send livereload signals, which you can use to automatically refresh your browser window.

 

Note the way the task is specified in the «sass» watch config. Calling «sass:dev» instructs it to use the «dev» config block from the «sass» task. Using «sass» by itself as the name of the task would have invoked both «sass:dev» and «sass:deploy» from our configuration above.

Also note how we’re using a top-level «options» definition here to make livereload the default. You can then override that for an individual watch definition if you don’t need livereload for that one.

In order for the browser to make use of the livereload signals, we’ll need to add a <script> tag that retrieves code from the livereload server that Grunt starts in the background. In Django, you’ll want to hide this tag behind a DEBUG check.

 

You can also use a LiveReload browser extension instead.

More to come

Grunt is a fantastic tool and one that makes it easier to work with the growing set of frontend tools that are emerging. There’s a vibrant plugin ecosystem, and its capabilities are growing all the time. I’ll be covering more of those tools in the future, and I’ll be sure to include Grunt configuration for each one. Enjoy!

Brandon Konkle