Skip to content

sqlite-web

sqlite ile çalışırken bir ide ihtiyacınız olursa ve progralama diliniz python ise web tabanlı sqlite-web isimli basit bir çözüm mevcut. kurulum için

pip install sqlite-web

ve kullanım için ise

sqlite_web veritabani.db -H 0.0.0.0 -p 8080

yeterli olacaktır. sqlite-web flask tabanlı olduğu ihtiaç duyulan kütüphane sayısı fazla olabilir. mevcut projelerinizi bozmamak adına virtualenv ile çalışılması tavsiye edilmektedir.

proje sitesi : https://github.com/coleifer/sqlite-web

python – pip ile güncel olmayan paketlerin güncellenmesi

windows altında python ile çalışıyor ve paket yöneticisi olarak pip kullanıyorsanız

pip list --outdated

ile güncel olmayan paket listesini görebilirsiniz.

PS C:\python> pip list --outdated
Package                  Version      Latest       Type
------------------------ ------------ ------------ -----
absl-py                  0.11.0       0.12.0       wheel
add-trailing-comma       2.0.2        2.1.0        wheel
aiohttp                  3.7.4        3.7.4.post0  wheel
APScheduler              3.6.3        3.7.0        wheel
astroid                  2.5.1        2.5.2        wheel
autoflake                1.3.1        1.4          sdist

paketlerin hepsini güncellemek istiyorsanız

pip list --outdated --format freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}

işinize yarayacaktır. paket bağlımlıklarında dolayını bunu önermiyorum. paket bağmlılıkları bir çok konuda sorun olabileceği için virtualenv kullanmanılması tavsiye edilir..

Python – Selenium kullarak wordpress admin paneline giriş

web hasadı ,kazıma, test vb yöntemler için en kullanışlı araçlardan bir tanesi selenium kütüphanesi. diğer bir deyişle web üzerinde herhangi bir işi otomatize etmek istiyor, bir siteden veri çekmek istiyorsanız selenium ihtiyacınızı karşılamakta yardımcı olacaktır.

bu kısa yazıyı selenium kullanarak wordpress kullanan bir siteye giriş yapmanın nasıl yapılabileceğine gösteren en temel python kodunu ile sonlandıralım.

from selenium import webdriver
import time
browser = webdriver.Firefox()
url = "https://www.wordpresssitsi.com/wp-admin/" 
browser.get(url)  
username = browser.find_element_by_id("user_login") 
password = browser.find_element_by_id("user_pass") 
username.send_keys("k_adi") # wordpress kullanici adi
password.send_keys("k_adi_sifre") # wordpress kullanici adi
submitButton = browser.find_element_by_id("wp-submit") 
submitButton.click()
time.sleep(10)
browser.close()

python da pandas ile excel üzerinde çalışmak – 1

pythonda excel dosyaları ile çalışmak için kullanabileceğiniz kütüphane sayısı oldukça fazla. bu kütüphanlerin kendine göre avantajları mevcut. bu kısa yazıda kullanımı oldukça kolay olan pandaw dan bahsedegim

öncelikle pandası kuralım

pip3 install pandas

kurulum sorunsuz olarak tamamlandıktan sonra ilk örneğimizi yapabiliriz. temel ıolarak üç adım mevcut.

import pandas as pd   # 1. adim kutuphaneyi import ediyoruz

excel_text = pd.read_excel(r'router.xls')  # 2. adim excel dosyami belirtiyoruz

print (excel_text ) # 3. ekrana yazdiriyoruz / işliyoruz..

en temel haliye excel içindeki verileri text ortamına aktarmış olduk.. bu python dosyamızı çalıştırınca aşagıdaki şekilde bir çıktı elde ediyoruz.

root@fcicek:~/python/# python3 router_excel.py 
       router interface
0    router_a     0/0/1
1    router_b     0/0/2
2    router_c     0/0/3

csv dosyası üzerinde çalışmak istereniz read_excel yerine read_csv kullanmanız gerekmektedir. ; ile ayrılmış ve utf8 ile kodlanmış bir csv dosyasında çalışmak isterseniz

data = pd.read_csv (r'router.csv', sep=';', encoding='utf8', quotechar='"') 

işinize yarayacaktır. eğer herhangi bir sutun veya satır ile çalışmak istiyorsak

df = pd.DataFrame(data, columns= ['router'])

ile çalışacağınız sütünu seçebilirsiniz. satırları okuyorak satırlardaki veriler ile işlem yapmak için ise


for i in df.index:
    print(df['router'][i]+'----'+df['interface'][i])

yapısını kullanabilirsiniz. pandas konusunda daha detaylı bilgilere erişmek isterseniz aşagıdaki bağlantılar işinize yarayacaktır

https://pandas.pydata.org/docs/

https://pandas.pydata.org/docs/pandas.pdf

https://pandas.pydata.org/Pandas_Cheat_Sheet.pdf

huawei network ekipmanları için ekran uzunluğu / sayfalama

ssh veya telnet ile bir network ekipmanına bağlanıp koşturduğunuz komutun çıktısını nakmak istiyorsanız sayfalama oldukça faydalı olmaktadır. “display current-configuration” komutunu çalıştırdığımızda

<fcicek_router>display current-configuration 
!Software Version V200R011C10SPC600
#
sysname fcicek_router
#
info-center loghost source Vlanif100
info-center loghost 10.10.10.199
#
vlan batch 2 to 4094
#
loopback-detect auto disable
loopback-detect packet-interval 10
#
stp timer hello 100
stp timer forward-delay 400
stp timer max-age 600
stp timer-factor 1
stp enable
stp converge fast
#
undo authentication unified-mode
#
domain fcicek admin
#
igmp-snooping enable
  ---- More ----

şeklinde bir durumla karşılaşırız.. konfigürasyonun devamını görmek için boşluk tuşuna basmak gerekmektedir. huawei network ekipmanlarında varsayılan sayfalama / ekran uzunluğu değeri 24 dir. bu değeri 0 – 512 arasında değiştirilebilmektedir.

herhanngi bir komutun çıktısını bir yazılım içinde yapıyorsanız, yazılım içinde sayfa sonlarının kontrolünün yapılması ihtiyacını doğurur. huawei ekipmanlarında bu kontrolü “—- More —-” olarak yapılması gerekiyor.

Bu kontrolü yapmak istemiyorsanız network ekipmanına bağlandıktan sonra ilk çalıştırılması gereken komutlardan bir tanesi; sayfalama özelliğini kapatmak olacaktır. Bunun için

screen-length 0 temporary

komutunu çalıştırmanız yeterli olacaktır. kullanıcıların / oturumların varsayılan değerler dışında bir değer kullanmak istiyorsanız user-interface altında değişiklik ile gerçekleştirebilirsiniz.

[fcicek_router]user-interface vty 0 4
[fcicek_router-ui-vty0-4]screen-length 0

ssh bağlantısında hesap değişim algoritmasının kullanılması

komut satırından ssh kullanmaya yeni başladıysanız aşagıdakine benzer hatalar ile karşılaşırsanız bunun nedeni sunucu tarafından bir hesap değişim algoritmasının aktif eilmiş olmasındandır.

# ssh  -p 3333 sshuser@ferhatcicek.com
Unable to negotiate with 10.66.26.35 port 3333: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1

peki bu durumda ne yapacaksınız. yukarıdaki çıktıda diffie hellman algoritmasının kullanıldığı belirtiliyor. ssh bağlantısında parametre olarak bunu belirmemiz gerekmektedir.

# ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c 3des-cbc -p 3333 sshuser@ferhatcicek.com 

komutu eksiksiz olarak yazdıysak aşagıdaki şekilde bir çıktı ile karşılacağız..

The authenticity of host '[ferhatcicek.com]:3333 ([10.66.26.35]:3333)' can't be established.
RSA key fingerprint is SHA256:NHXQ1no3z/Z2e/KoqrKyn0vNKlYhKmhvhtsQFXS4rvk.
Are you sure you want to continue connecting (yes/no/[fingerprint])?

yes yazarak kabul ettikten sonra ne bağlantı gerçekleşmiş olacak

huawei network ekipmanlarında lisans dosyaları

huawei cihazlarda lisanslama sırasında bir tane xml ve bir tane dat dosyası kullanılmakta.. bu dosya örnekleri ve içerisinde yer alan börümlere ait açıklamalar aşağıdaki tablolarda yer almaktadır

örnek xml lisans dosyası

ModuleParameterMandatoryDescription
LicFile formatVersionYesVersion of the license file format. The format version of each XML license file is 3.00 or later.
 GeneralInfoCopyRightYesCopyright information.
 LSNYesThe license serial number is also known as the Fulfillment ID, and is the unique identifier of a license file. You can search for a license file on license management pages of the ESDP website. To check the LSN, run the display license command.
 LicTypeYesCOMM indicates a permanent commercial license that has been purchased. DEMO indicates a non-permanent-commercial license.
 GraceDayYesNumber of days in the grace period after the license file expires. The value is fixed at 60.
 CreatorYesPublisher information. This parameter has a fixed value of Huawei Technologies Co., Ltd..
 IssuerYesName of the user who generated the license file in the license distribution system. For a commercial license file, the value is fixed at License Distribution Center. For a non-commercial license file, the value is the applicant information.
 CreateTimeYesTime when the license file was created, and is the local system time of the license distribution system, rather than the system time of the NE that uses the license.
 CustomerInfoCustomerNoCustomer name.
 CountryNoCountry name.
 OfficeNoCity name.
 NodeInfoNodeYesDevice ID.
 DesNoDevice description.
 LockModelNoLock mode. NODELOCK indicates single node lock mode, and DUALLOCK indicates dual node lock mode. By default, the single node lock mode is used.
 ESNYesElectronic serial number of a device, also called device fingerprint. It is a string of characters that uniquely identifies a device and ensures that a license is authorized to the device.
 SaleInfoOfferingProductYesProduct name and version.
 SaleItemYesSales item code.
 ValueYesSales volume.
 DesChsNoDescription of the sales item, in Chinese.
 DesEngNoDescription of the sales item, in English.
 CapacityKeyNoResource control service license item. Value indicates the number of authorized resources. validDate indicates the authorization expiration date. If the date is PERMANENT or left blank, the authorization is permanent.
 FeatureKeyNoFunction control service license item. The Value is fixed at 1. validDate indicates the authorization expiration date. If the date is PERMANENT or left blank, the authorization is permanent.
 KeyInfoproductNameYesProduct name and version.
 CapacityKeyNoResource control service license item. name indicates the sales item name; group indicates the sales item type; Value indicates the number of authorized resources; validDate indicates the authorization expiration date. If the date is PERMANENT or left blank, the authorization is permanent.
 FeatureKeyNoFunction control service license item. name indicates the sales item name. group indicates the sales item type. The Value is fixed at 1. validDate indicates the authorization expiration date. If the date is PERMANENT or left blank, the authorization is permanent.
 FooterCommonSignYesSignature.
 ProductSignYesmethod indicates the encryption algorithm. Currently, the 1-RSA1024, 2-RSA2048, 3-ECC163, and 4-ECC233 encryption algorithms are supported.

dat lisans dosyası

ParameterMandatoryDescription
LicenseSerialNoYesThe license serial number is also known as the Fulfillment ID, and is the unique identifier of a license file. You can search for a license file on license management pages of the ESDP website. To check the LSN, run the display license command.
CreatorYesPublisher information. This parameter has a fixed value of Huawei Technologies Co., Ltd..
CreatedTimeYesTime when the license file was created. The time is the local system time of the license distribution system, rather than the system time of the NE that uses the license.
CountryYesCountry name.
CustomYesCustomer name.
OfficeYesRegion name or user ID in a contract.
SignYesSignature.
ProductYesProduct name.
FeatureYesLicense item type.
EsnYesElectronic serial number of a device, also called device fingerprint. The ESN is a string of characters that uniquely identifies a device and ensures that a license is authorized to the device. If there are multiple ESNs, the license file can be allocated to multiple devices.
AttribYesSix fields separated by commas from left to right: In the first field, COMM indicates a permanent commercial license that has been purchased. DEMO indicates a non-permanent-commercial license.The second field indicates the authorization expiration date. PERMANENT indicates that the authorization is permanent. NULL indicates that the parameter is invalid.The third field indicates the number of days in the grace period after the license file expires. NULL indicates that the parameter is invalid.The fourth field indicates the software maintenance expiration date. NULL indicates that the parameter is invalid.The fifth field indicates the hardware maintenance expiration date. NULL indicates that the parameter is invalid.The sixth field indicates the expiration date of free software upgrades. NULL indicates that the parameter is invalid.
VersionYesProduct version.
LibverNoVersion of the license file format.
ResourceNoResource control service license item. The value following the equal sign (=) in each license item indicates the number of authorized resources.
FunctionNoFunction control service license item. The value following the equal sign (=) in each license item is fixed at 1.
CommentNoComment information, such as the project name, order, and contract.

nokia / alcatel 68xx omni switchlerde linkagg size değişimi

alcatel switchlerde linkagg yi aktif etmişseniz ve sonrasında lag altındaki link sayısını arttırmak isterseniz ne yazıkki aktif çalışan sistemde bunun yapılmasına switch yazılımı izin vermiyor..

6850-> lacp linkagg 1 size 4
ERROR: LAERR08 This aggregate already exists 1

1 id linkagg in zaten mevcut olduğunu söylerek değişimize izin vermiyor. 1 id li linkagg ile ilişkilendirilmemiş fazla tanım yoksa farklı bir id ile linkagg tanıtılarak tanımlar bunun üzerine taşınabilir. ancak çok fazla ilişkili tanım varsa bunu yapmak zor olabilir.. switchin aktif linkagg konfigürasyonun

! Link Aggregate :
lacp linkagg 1 size 2 admin state enable
lacp linkagg 1 actor admin key 32768
lacp agg 1/1 actor admin key 32768
lacp agg 1/2 actor admin key 32768

şeklinde oluğunu varsayalım. benim linkagg size ını arttırmak için kullandığım yöntem boot.cfg dosyasını düzenlemek ve switchi bu konfigürasyon ile yeniden başlatmak. switch üzerinde vi editoru mevcut. vi ile boot.cfg dosyasını açalım

6850-> vi working/boot.cfg

dosyası açtıktan sonra ” lacp linkagg 1 size 2 admin state enable” satırını bulalalım “lacp linkagg 1 size 3 admin state enable” olarak değiştirelim ve değişikliği kaydedelim

vi kullanmayı bilmiyorsanız yapılacka işlem 2 nin üzerine gelin x ile 2 yi silin i ye basın sonrasında 3 yazın esc tuşuna baştıktan sonra 😡 ile dosyayı kaydedip çıkın

şimdi switchi başlantmaya sıra geldi. switch working konfig ile yeniden başlatalım.

6850-> reload working rollback-timeout 15
Confirm Activate (Y/N) : Y

yukarıaki roolback-timeout 15 yazarak eğer bir sorun olursa switchin 15 dakika sonra yeniden başlatmasını belirttik. switch up olduktan sonra yaptığımız değişikliğin uygulanıp uygulanmadığını kontrol edelim

6850-> show configuration snapshot linkagg
! Link Aggregate :
lacp linkagg 1 size 3 admin state enable
lacp linkagg 1 actor admin key 32768
lacp agg 1/1 actor admin key 32768
lacp agg 1/2 actor admin key 32768

sorun yokssa yeniden başlatmayı iptal edelim.

6850-> reload cancel
Primary reload scheduled in 757 seconds, Confirm cancel reload (Y/N) : Y

lingagg size değerinin arttırdığıma göre lag altında ilave portumuzu ekleyebiliriz

lacp agg 1/3 actor admin key 32768

nginx den alan adının ve sertifikanın silinmesi

öncelikle alan adımı tanımlayalım

alanadi=ferhatcicek.com

alanadına ait konfigürasyon dosyalarını silelim

sudo rm /etc/nginx/sites-available/$alanadi
sudo rm /etc/nginx/sites-enabled/$alanadi

nginx i yeniden başlatalım

sudo nginx -t  
sudo service nginx restart

ve mevcut sertifikaları görüntüleyelim ve alanadına ait sertifikayı certboot ile silelim

certbot certificates

sudo certbot delete --cert-name $alanadi

Let’s Encrypt sertifikasının silinmesi

Let’s Encrypt dan bir sertifika aldıysanız sertifikaya ait dosyalar

/etc/letsencrypt/archive
/etc/letsencrypt/live
/etc/letsencrypt/renewal

dizinleri altında tutulmaktadır. herhangi bir alanadına ait sertifikayı silmek isterseniz

sudo certbot delete

komutu kullanabilir ve listden alan adı seçilerek işlem yapılabilir veya doğrudan alarn adı belirterek

sudo certbot delete --cert-name alanadi.com

sertifika silinebilir

Back To Top