Showing posts with label пиздец. Show all posts
Showing posts with label пиздец. Show all posts

July 19, 2017

debug opencart 2.3 events triggers not working

Opencart's Event system is a better alternative to vQmod, although how to use it is not obvious, and the documentation is poorly written. As usual, working with Opencart is a major pain in the ass. I've spent quite a lot of hours trying to figure out how Events are supposed to work. I decided to write something down because surprisingly there doesn't seem to be a lot of information online. If you found this and still can't figure it out, please comment and I'll try to elaborate.

Here's how I was debugging them:

  • To debug what events are present on a given page, go to the Event::trigger() function and var_dump the $event variable. Those are the hooks you can listen on
  • Use either catalog or admin (depending on where's your callback) controller/startup/event.php file to check if your event was registered. This file's register function adds the events to the queue using the similarly named register() function from system/engine/event.php above. Once it's done, you can dump it's $this->data variable and check if a. your event is there and b. if it has a valid action. Here's what a valid action looks like:
  • If your action is null, the system may be looking for a wrong callback path. The action for your event is built upon the callback route you provide when you register an event. That route is then converted into a full path of a file the system tries to load and execute. 
  • If you're trying to hook before admin/controller/catalog/product::index(), your event trigger will be admin/controller/catalog/product/before, note that "index" gets omitted.
  • Another gotcha. When Opencart tries to execute an action, it checks if the number of parameter your callback action expects matches the number of arguments it's about to pass to it. If it doesn't match, the action will fail silently, with the Error: Could not call message only visible in the debug trace. The solution is to make your callback arguments optional.

February 11, 2017

Bootstrap's tooltips on iOS require a double tap to activate

There's a problem with Bootstrap's tooltip plugin: when used on a smartphone, it requires a double tap to trigger an element it is attached to. For example, I had a tooltip added to a button. The first tap would show the tooltip, but to actually trigger the button I had to tap it one more time, and that wasn't obvious.

I searched for a solution online, and found a bug report closed by maintainers claiming that it wasn't an issue, and the solution was to not use the tooltips (?!).

Here's a workaround I ended up using:

jQuery(document).ready(function(){
jQuery("label[data-toggle=tooltip]").on('show.bs.tooltip', function (e) {
    if ('ontouchstart' in document.documentElement) {
        e.preventDefault();
    }
});

September 30, 2014

Как устранить уязвимость Shellshock на сервере или VDS под управлением Debian

Проверьте присутствует ли уязвимость:

env X="() { :;} ; echo busted" bash -c "echo stuff"

Если в выводе содержится "busted", дыра Shellshock присутствует.


Как это выглядит на уязвимой машине под управлением Debian OpenVZ VPS:

Вверху видно что текущая версия Bash это 4.2.


Теперь латаем дыру.


Обновляем список пакетов.

apt-get update

Проверьте свою версию баша. В моем случае это была 4.2+dfsg-0.1+deb7u3. Обновите баш. Здесь описано как выбрать определенную версию пакета для установки в случае если доступны несколько.

apt-get install bash=4.2+dfsg-0.1+deb7u3

Воткак выглядит пропатченный сервер:

Старая версия была 4.2+dfsg-0.1, после обновления стала 4.2+dfsg-0.1+deb7u3. Ну и последний тест, в результате которого значение busted не выводится.


Источник: http://habrahabr.ru/company/mailru/blog/238475/

How to quickly check and fix the Shellshock Bash vulnerability

First, see if this applies to you. Though since all of the bash versions for the last 25 years are vulnerable to this exploit, it most likely does.


To check if your machine has the Shellshock vulnerability, run the following:

env X='() { :;}; echo vulnerable' bash -c "echo this is a test"

If the output includes "busted", the machine is vulnerable to the Shellshock exploit.


Here's an example of how the output looks like on an infected Debian OpenVZ VPS:

At the top of the output you can see the current Bash version being 4.2.


Now, this is the time to update your bash version to the one that is more secure and has the exploit patched.


First, update the package list.

apt-get update

Refer to this in case you get the GPG errors.

Then see what's the latest Bash version you got. In my case it was 4.2+dfsg-0.1+deb7u3. Upgrade Bash to the latest version. Here's how you can specify which version of the package to install in case you have multiple available.

apt-get install bash=4.2+dfsg-0.1+deb7u3

This will install the recent version.


Here's how the patched VPS looks like now:

As you can see, initially the bash version was 4.2+dfsg-0.1, and after the upgrade it's 4.2+dfsg-0.1+deb7u3. Then there's another test which doesn't output the busted value anymore.


Source: http://habrahabr.ru/company/mailru/blog/238475/

UPD: More vulnerabilities to test against: http://en.wikipedia.org/wiki/Shellshock_(software_bug)#Reported_vulnerabilities. Bad news is that not all of those are fixed by the update, so now we wait.

January 25, 2010

Де-демотиваторы

Не всякая картинка в чёрной рамке, с тупорылой подписью и копирайтом, содержащим слово demotivators, является собственно демотиватором.

Говоря ЧПЯ (человекопонятным языком), свыше 90% «демотиваторов», загружаемых везде и всюду — отнюдь не демотиваторы, а откровенная, искренняя хуита. Это спровоцировано ошибочным предположением, что достаточно к дешёвой картинке, обрамлённой в толстую чёрную рамку, подставить псевдоскандальную подпись и дополнить это всё беспомощным объяснением, чтобы получился труъ-демотиватор.

Переломным (в худшую сторону) пунктом в этой войне за здравый смысл стал запуск сервисов, где любое ... при помощи специально обученных скриптов может сотворить то, что потом ошибочно называет демотиватором. Это снизило т.н. «порог вхождения» до отрицательного значения, пополнив при этом актив соответствующих сервисов (и, заодно, интернет) миллиардом тупейших картинок.

Особенно бесят про ВОВ и День победы. Содержание приблизительно следующее: фотография пожилого ветерана в слезах рядом с тематическим объектом (мемориал, танк, etc.) и подпись: «Ему есть что вспомнить, а тебе — нет». Да я больше чем уверен, что запечатлённый на фото человек отдал бы многое (если и не всё) чтобы не помнить ужасы войны, гибель друзей, разлуку с близкими, и разрушенный родной дом по возвращении. Неужели убербыдло, размножающее это, наивно верит что перечисленные вещи вспоминаются с тёплой печалью ностальгии? Видимо да, а это ещё раз подтверждает что столь драматизирующие дебилы ничего в этой трагедии не понимают, и в итоге — не более чем лицемерят.