Last active
April 27, 2025 07:43
-
-
Save alpgul/ce2458bfcec06b82b13f26ff48883b53 to your computer and use it in GitHub Desktop.
Revisions
-
alpgul revised this gist
Apr 27, 2025 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,13 +25,6 @@ function createProxyHandler(baseEval) { throw new Error(`Geçersiz özellik adı: ${String(property)}`); } // eval fonksiyonunu özel olarak izleme if (property === 'eval') { @@ -42,6 +35,13 @@ function createProxyHandler(baseEval) { }; } // Önce target'ta saklanan native fonksiyon var mı kontrol et const nativeFunc = target[baseEval + "." + property]; if (nativeFunc ) { return nativeFunc; } const value = eval(`${baseEval}.${property}`); // baseEval.property // Fonksiyonları izlemek için Proxy if (typeof value === 'function') { const base = eval(baseEval); -
alpgul revised this gist
Apr 27, 2025 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,8 +61,8 @@ function createProxyHandler(baseEval) { } return value; } catch (err) { error(`eval ile erişim hatası (özellik: ${String(property)}):`, err); return undefined; // Hata durumunda undefined dön } }, -
alpgul revised this gist
Apr 27, 2025 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,10 +44,11 @@ function createProxyHandler(baseEval) { // Fonksiyonları izlemek için Proxy if (typeof value === 'function') { const base = eval(baseEval); target[baseEval + "." + property] = new Proxy(value, { apply(targetFn, thisArg, args) { log(`Fonksiyon çağrıldı: ${String(property)}, Argümanlar:`, args); return Reflect.apply(targetFn, base, args); } }); return target[baseEval + "." + property]; -
alpgul revised this gist
Apr 27, 2025 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -86,8 +86,8 @@ function createProxyHandler(baseEval) { eval(`${baseEval}.${property} = ${JSON.stringify(value)}`); } return true; } catch (err) { error(`eval ile yazma hatası (özellik: ${String(property)}):`, err); return false; // Hata durumunda false dön } } -
alpgul revised this gist
Apr 27, 2025 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ let temp; const tempWindow={} const log=console.log; const error=console.error; // Geçerli JavaScript tanımlayıcı kontrolü (güvenlik için) @@ -97,4 +98,4 @@ function createProxyHandler(baseEval) { const proxyHandler = createProxyHandler('window'); // Boş obje ile Proxy oluşturma const windowProxy = new Proxy(tempWindow, proxyHandler); -
alpgul revised this gist
Apr 27, 2025 . 1 changed file with 7 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,14 +25,9 @@ function createProxyHandler(baseEval) { } // Önce target'ta saklanan native fonksiyon var mı kontrol et const nativeFunc = target[baseEval + "." + property]; if (nativeFunc ) { return nativeFunc; } const value = eval(`${baseEval}.${property}`); // baseEval.property @@ -48,17 +43,19 @@ function createProxyHandler(baseEval) { // Fonksiyonları izlemek için Proxy if (typeof value === 'function') { target[baseEval + "." + property] = new Proxy(value, { apply(targetFn, thisArg, args) { log(`Fonksiyon çağrıldı: ${String(property)}, Argümanlar:`, args); return Reflect.apply(targetFn, thisArg, args); } }); return target[baseEval + "." + property]; } // Value obje mi kontrolü ve recursive Proxy (boş obje ile) if (value && typeof value === 'object') { target[baseEval + "." + property] = new Proxy(target, createProxyHandler(`${baseEval}.${property}`)); // Güncellenmiş baseEval return target[baseEval + "." + property]; } return value; -
alpgul revised this gist
Apr 26, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -79,7 +79,7 @@ function createProxyHandler(baseEval) { // Fonksiyon kontrolü if (typeof value === 'function') { if (isNativeFunction(value)) { temp = value; eval(`${baseEval}.${property} = temp`); }else{ eval(`${baseEval}.${property} = ${value}`); -
alpgul revised this gist
Apr 26, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ let temp; const log=console.log; const error=console.error; // Geçerli JavaScript tanımlayıcı kontrolü (güvenlik için) function isValidIdentifier(str) { return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str); -
alpgul revised this gist
Apr 26, 2025 . 1 changed file with 9 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ let temp; const log=console.log; cont error=console.error; // Geçerli JavaScript tanımlayıcı kontrolü (güvenlik için) function isValidIdentifier(str) { return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str); @@ -13,7 +15,7 @@ function isNativeFunction(fn) { function createProxyHandler(baseEval) { return { get(target, property, receiver) { log(`Erişilen özellik: ${String(property)}`); // eval ile baseEval.property formatında erişim try { @@ -27,7 +29,7 @@ function createProxyHandler(baseEval) { if (nativeFunc && isNativeFunction(nativeFunc)) { return new Proxy(nativeFunc, { apply(targetFn, thisArg, args) { log(`Native fonksiyon çağrıldı: ${String(property)}, Argümanlar:`, args); return Reflect.apply(targetFn, thisArg, args); } }); @@ -38,7 +40,7 @@ function createProxyHandler(baseEval) { // eval fonksiyonunu özel olarak izleme if (property === 'eval') { return function (code) { log('eval çağrıldı, çalıştırılan kod:', code); // eval'i receiver bağlamında çalıştır return eval.call(receiver, code); }; @@ -48,7 +50,7 @@ function createProxyHandler(baseEval) { if (typeof value === 'function') { return new Proxy(value, { apply(targetFn, thisArg, args) { log(`Fonksiyon çağrıldı: ${String(property)}, Argümanlar:`, args); return Reflect.apply(targetFn, thisArg, args); } }); @@ -61,12 +63,12 @@ function createProxyHandler(baseEval) { return value; } catch (error) { error(`eval ile erişim hatası (özellik: ${String(property)}):`, error); return undefined; // Hata durumunda undefined dön } }, set(target, property, value, receiver) { log(`Özellik değiştirildi: ${String(property)}, Yeni değer:`, value); // eval ile baseEval.property = value formatında atama try { @@ -87,7 +89,7 @@ function createProxyHandler(baseEval) { } return true; } catch (error) { error(`eval ile yazma hatası (özellik: ${String(property)}):`, error); return false; // Hata durumunda false dön } } -
alpgul revised this gist
Apr 26, 2025 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ let temp; // Geçerli JavaScript tanımlayıcı kontrolü (güvenlik için) function isValidIdentifier(str) { return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str); @@ -76,11 +77,11 @@ function createProxyHandler(baseEval) { // Fonksiyon kontrolü if (typeof value === 'function') { if (isNativeFunction(value)) { tmep = value; eval(`${baseEval}.${property} = temp`); }else{ eval(`${baseEval}.${property} = ${value}`); } } else { eval(`${baseEval}.${property} = ${JSON.stringify(value)}`); } -
alpgul revised this gist
Apr 26, 2025 . 1 changed file with 29 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,11 @@ function isValidIdentifier(str) { return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str); } // Native fonksiyon kontrolü function isNativeFunction(fn) { return typeof fn === 'function' && fn.toString().includes('[native code]'); } // createProxyHandler fonksiyonu function createProxyHandler(baseEval) { return { @@ -15,6 +20,18 @@ function createProxyHandler(baseEval) { if (!isValidIdentifier(property)) { throw new Error(`Geçersiz özellik adı: ${String(property)}`); } // Önce target'ta saklanan native fonksiyon var mı kontrol et const nativeFunc = target['__native_' + property]; if (nativeFunc && isNativeFunction(nativeFunc)) { return new Proxy(nativeFunc, { apply(targetFn, thisArg, args) { console.log(`Native fonksiyon çağrıldı: ${String(property)}, Argümanlar:`, args); return Reflect.apply(targetFn, thisArg, args); } }); } const value = eval(`${baseEval}.${property}`); // baseEval.property // eval fonksiyonunu özel olarak izleme @@ -56,7 +73,17 @@ function createProxyHandler(baseEval) { if (!isValidIdentifier(property)) { throw new Error(`Geçersiz özellik adı: ${String(property)}`); } // Fonksiyon kontrolü if (typeof value === 'function') { if (isNativeFunction(value)) { // Native fonksiyonu target'a sakla target['__native_' + property] = value; return true; } eval(`${baseEval}.${property} = ${value}`); } else { eval(`${baseEval}.${property} = ${JSON.stringify(value)}`); } return true; } catch (error) { console.error(`eval ile yazma hatası (özellik: ${String(property)}):`, error); @@ -70,11 +97,4 @@ function createProxyHandler(baseEval) { const proxyHandler = createProxyHandler('window'); // Boş obje ile Proxy oluşturma const windowProxy = new Proxy({}, proxyHandler); -
alpgul created this gist
Apr 26, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,80 @@ // Geçerli JavaScript tanımlayıcı kontrolü (güvenlik için) function isValidIdentifier(str) { return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str); } // createProxyHandler fonksiyonu function createProxyHandler(baseEval) { return { get(target, property, receiver) { console.log(`Erişilen özellik: ${String(property)}`); // eval ile baseEval.property formatında erişim try { // Güvenlik kontrolü: property geçerli bir tanımlayıcı mı? if (!isValidIdentifier(property)) { throw new Error(`Geçersiz özellik adı: ${String(property)}`); } const value = eval(`${baseEval}.${property}`); // baseEval.property // eval fonksiyonunu özel olarak izleme if (property === 'eval') { return function (code) { console.log('eval çağrıldı, çalıştırılan kod:', code); // eval'i receiver bağlamında çalıştır return eval.call(receiver, code); }; } // Fonksiyonları izlemek için Proxy if (typeof value === 'function') { return new Proxy(value, { apply(targetFn, thisArg, args) { console.log(`Fonksiyon çağrıldı: ${String(property)}, Argümanlar:`, args); return Reflect.apply(targetFn, thisArg, args); } }); } // Value obje mi kontrolü ve recursive Proxy (boş obje ile) if (value && typeof value === 'object') { return new Proxy({}, createProxyHandler(`${baseEval}.${property}`)); // Güncellenmiş baseEval } return value; } catch (error) { console.error(`eval ile erişim hatası (özellik: ${String(property)}):`, error); return undefined; // Hata durumunda undefined dön } }, set(target, property, value, receiver) { console.log(`Özellik değiştirildi: ${String(property)}, Yeni değer:`, value); // eval ile baseEval.property = value formatında atama try { // Güvenlik kontrolü: property geçerli bir tanımlayıcı mı? if (!isValidIdentifier(property)) { throw new Error(`Geçersiz özellik adı: ${String(property)}`); } eval(`${baseEval}.${property} = ${JSON.stringify(value)}`); return true; } catch (error) { console.error(`eval ile yazma hatası (özellik: ${String(property)}):`, error); return false; // Hata durumunda false dön } } }; } // Proxy handler'ı window için oluştur const proxyHandler = createProxyHandler('window'); // Boş obje ile Proxy oluşturma const windowProxy = new Proxy({}, proxyHandler); // Test: windowProxy üzerinden eval ile kod çalıştırma windowProxy.eval(` window.location.href; // Erişim testi window.testProp = 'Deneme'; // Değişiklik testi window.alert('Merhaba!'); // Fonksiyon çağrısı testi `);