Как стать автором
Обновить

Комментарии 6

По версии кода для человеков, взял пример с памятью и попросил ChatGPT поправить нейминг переменных, результат:

function retrieveMemoryProperties(memoryPrototype, filteredProperties) {
    (memoryPrototype = p),
    (filteredProperties = Object.getOwnPropertyNames(
        Object.getPrototypeOf(window.performance.memory)
    ).filter(function(propertyName, currentPrototype) {
        return (currentPrototype = memoryPrototype), propertyName !== 'constructor';
    })),
    filteredProperties.map(function(propertyName, currentMemoryPrototype) {
        (currentMemoryPrototype = memoryPrototype), memoryPropertiesArray.push(window.performance.memory[propertyName].toString(36));
    });
}

function callRetrieveMemoryProperties() {
    if ((retrieveMemoryProperties(), callCounter++, callCounter === 3)) return void callUnknownFunction();
    setTimeout(callRetrieveMemoryProperties, 55);
}

ИИ так же дал описание того что делает функция:

It's difficult to say exactly what this code does without knowing what the other variables, such as p, c, and h, are and what the e function does. However, I can tell you what this code appears to do in a general sense.

The retrieveMemoryProperties function takes two arguments, memoryPrototype and filteredProperties. memoryPrototype is assigned the value of p, and filteredProperties is assigned the result of filtering the property names of the prototype of the window.performance.memory object. The filtered properties are those whose names are not equal to 'constructor'.

The filtered properties are then mapped over, and for each property, the value of memoryPrototype is assigned the value of p, and the value of the property is pushed onto an array called memoryPropertiesArray as a base-36 string.

The callRetrieveMemoryProperties function calls the retrieveMemoryProperties function, increments a counter callCounter, and checks if it's equal to 3. If it is, it calls an unknown function callUnknownFunction. If not, it sets a timeout to call callRetrieveMemoryProperties again in 55 milliseconds.

Кажется с подсказками ИИ разбирать такой код может быть проще.

Кажется с подсказками ИИ разбирать такой код может быть проще.

Наверное, поначалу да, но со временем потребность в этом отпадает, если честно) Когда постоянно читаешь подобного рода скрипты, то как-то без особых проблем понимаешь происходящее. Но, как ещё один из вариантов применения ChatGPT, почему нет. Возьму на заметку, спасибо.
А ещё, чтобы лучше разбираться в техниках минификации и не впадать в ступор при виде !0 вместо true, стоит погуглить(или поспрашивать у ChatGPT) "JavaScript golfing". Например, можно почитать что-то подобное.

Я так понимаю, мало кто дочитал до конца, но проделанная тут работа просто божественна!

Это очень круто, спасибо! По работе часто сталкиваюсь с защитой Cloudflare, давным-давно были рабочие аддоны для того же Scrapy, чтобы handshake этот проделывать, но они уже давно не работают. Стоит чему-то подобному получить огласку, и CF выкатывают обновление :) В закладки!

Отличная статья! Не знал что хитрую проверку плагинов можно обойти...

Зарегистрируйтесь на Хабре, чтобы оставить комментарий

Публикации

Истории