<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Daniyal Shahzad on Medium]]></title>
        <description><![CDATA[Stories by Daniyal Shahzad on Medium]]></description>
        <link>https://medium.com/@daniyal48?source=rss-1a9e9ba7494b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hoDMyz-ur491WEDAOWaIzg.jpeg</url>
            <title>Stories by Daniyal Shahzad on Medium</title>
            <link>https://medium.com/@daniyal48?source=rss-1a9e9ba7494b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 23:15:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daniyal48/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[PWNED: Huawei ONT HG8346R]]></title>
            <link>https://daniyal48.medium.com/pwned-huawei-ont-hg8346r-710b2e4d5d3d?source=rss-1a9e9ba7494b------2</link>
            <guid isPermaLink="false">https://medium.com/p/710b2e4d5d3d</guid>
            <dc:creator><![CDATA[Daniyal Shahzad]]></dc:creator>
            <pubDate>Thu, 10 Oct 2024 06:45:47 GMT</pubDate>
            <atom:updated>2024-10-10T06:45:47.916Z</atom:updated>
            <content:encoded><![CDATA[<h3>About:</h3><p>Huawei HG8346R is a GPON (Gigabit Passive Optical Network) terminal that serves as a fiber-to-the-home (FTTH) optical network unit. It is used to provide high-speed internet services and supports various broadband access scenarios. Including data, voice and video services. It supports up to 2.44 Gbps downstream and up to 1.244 Gbps speeds of upstream. It has 4 Ethernet RJ-45 ports and dual band wifi support upto 300 Mbps.</p><h3>Looking Around:</h3><p>First of all, I started with the WebUi because almost all the routers or ONTs I have seen so far have a WebUi. I conntected the ONT with my PC via Ethernet port because obviously we are getting started and I don’t know the wifi password yet. But I need to find the IP address to access the WebUI. There are two methods:</p><ol><li>Search the internet to find the default IP address of the ONT but if it comes pre-configured from the ISP they might have changed it from the defualt IP.</li><li>The easiest way if to check the your deafult gateway IP address.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*OrihGnmN8fATvGHBPzoD2w.png" /><figcaption>Default Gateway IP address</figcaption></figure><p>Once I had the address for my ONT I tried to access the IP addresss .i.e. <a href="http://192.168.100.1/">http://192.168.100.1</a> through my web browser and YUPPP!!! we have the web interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c3_p-fp_QrtfLvvCN6fLdQ.png" /><figcaption>HG8346R WebUi Login</figcaption></figure><p>The login credentials are mostly provided on the back of the ONT or you can try default login credenitals. I tried root:admin and it worked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*StjA8UzOXLHnRg_ACK4nag.png" /><figcaption>Device Information with User Account</figcaption></figure><p>But the problem is…that I can only access the basic settings of the ONT I mean I can’t even change the date/time of the ONT this indicates that I have only a normal user level access not a proper root or administrator level access right?? Lets dive a bit deep</p><h3>The LEGENDARY MASTER ACCOUNT!!!!</h3><p>You can call it a feature or a flaw from Huawei that they keep a master account on most of their products which is different than the user-accessible admin account according to information and knowledge I have so far this account is available on likely every Huawei device. Some of the ISPs have started to customize this master account with custom credentials but thats not easy and I don’t think so all of the ISPs have started doing this but you can change the master account credentials yourself too more on that later. Even after knowing thast ISPs have started to change the master account credentials but still I had to try my luck and this time I got lucky because the default credentials worked for me. Default credentials for master account were <strong>telecomadmin:admintelecom. </strong>As soon as I entered the ceredentials and <strong>voilà.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*SbgZUQXJsggslrSA" /><figcaption>Credits: memgenerator.net</figcaption></figure><p>With this account we can access various configuration settings and even download and upload configuration file from and on to the device respectively. With configuration file upload we can reuse this device with another ISP which is good for research purposes or doing some fun stuff with your ISP network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*sIOH-LbAzb9RUn50Wr7OoQ.png" /><figcaption>Configuration file menu</figcaption></figure><p>I downloaded the configuration file and started to analyze it.</p><h3>Configuration File Analysis:</h3><p>Usually the configuration files, when dowloaded, are encrypted from Huawei ONTs but not in this model so we don’t need “aescrypt2_huawei” to decrypt the configuration file as we can read the file directly as you can see in the provided screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yfQCaXYNy7FqIP_Hru_xTw.png" /><figcaption>Config file from ONT</figcaption></figure><p>After thoroughly analyzing the configuration file I found quite useful information.</p><h4>IP Address:</h4><pre>&lt;IPInterface NumberOfInstances=&quot;2&quot;&gt;<br>&lt;IPInterfaceInstance InstanceID=&quot;1&quot; Enable=&quot;1&quot; IPInterfaceIPAddress=&quot;192.168.100.1&quot; IPInterfaceSubnetMask=&quot;255.255.255.0&quot; IPInterfaceAddressingType=&quot;Static&quot; X_HW_AddressConflictDetectionEnable=&quot;1&quot;/&gt;<br>&lt;IPInterfaceInstance InstanceID=&quot;2&quot; Enable=&quot;1&quot; IPInterfaceIPAddress=&quot;192.168.2.1&quot; IPInterfaceSubnetMask=&quot;255.255.255.0&quot; IPInterfaceAddressingType=&quot;Static&quot; X_HW_AddressConflictDetectionEnable=&quot;1&quot;/&gt;<br>&lt;/IPInterface&gt;</pre><h4>Enabled Services:</h4><pre>&lt;AclServices HTTPLanEnable=&quot;1&quot; HTTPWanEnable=&quot;0&quot; FTPLanEnable=&quot;0&quot; FTPWanEnable=&quot;0&quot; TELNETLanEnable=&quot;1&quot; TELNETWanEnable=&quot;0&quot; SSHLanEnable=&quot;1&quot; SSHWanEnable=&quot;0&quot; HTTPPORT=&quot;80&quot; FTPPORT=&quot;21&quot; TELNETPORT=&quot;23&quot; SSHPORT=&quot;22&quot; HTTPWifiEnable=&quot;1&quot; TELNETWifiEnable=&quot;1&quot; WebPermanentCloseControl=&quot;0&quot;/&gt;</pre><h4>Accounts:</h4><pre>&lt;UserInterface&gt;<br>&lt;X_HW_CLIUserInfo NumberOfInstances=&quot;1&quot;&gt;<br>&lt;X_HW_CLIUserInfoInstance InstanceID=&quot;1&quot; Username=&quot;root&quot; Userpassword=&quot;465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac&quot; UserGroup=&quot;&quot; ModifyPWDFlag=&quot;0&quot; EncryptMode=&quot;1&quot;/&gt;<br>&lt;/X_HW_CLIUserInfo&gt;<br>&lt;X_HW_CLITelnetAccess Access=&quot;1&quot; TelnetPort=&quot;23&quot;/&gt;<br>&lt;X_HW_WebUserInfo NumberOfInstances=&quot;2&quot;&gt;<br>&lt;X_HW_WebUserInfoInstance InstanceID=&quot;1&quot; UserName=&quot;root&quot; Password=&quot;465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac&quot; UserLevel=&quot;1&quot; Enable=&quot;1&quot; ModifyPasswordFlag=&quot;0&quot; PassMode=&quot;2&quot;/&gt;<br>&lt;X_HW_WebUserInfoInstance InstanceID=&quot;2&quot; UserName=&quot;telecomadmin&quot; Password=&quot;402931e04c03e24d360477a9f90b9eb15777e154360f06228be15c37679016ef&quot; UserLevel=&quot;0&quot; Enable=&quot;1&quot; ModifyPasswordFlag=&quot;0&quot; PassMode=&quot;2&quot;/&gt;<br>&lt;/X_HW_WebUserInfo&gt;<br>&lt;X_HW_WebSslInfo Enable=&quot;0&quot; CertPassword=&quot;$1x&amp;apos;&amp;apos;b)e,hq4.xt@!30zkA,&amp;amp;!!$&quot;/&gt;<br>&lt;/UserInterface&gt;</pre><h4>FTP:</h4><pre>&lt;X_HW_ServiceManage FtpEnable=&quot;0&quot; FtpPort=&quot;21&quot; FtpRoorDir=&quot;/mnt/usb1_1/&quot; FtpUserNum=&quot;0&quot;/&gt;</pre><h4>Remote Management:</h4><pre>&lt;ManagementServer EnableCWMP=&quot;0&quot; URL=&quot;&quot; Username=&quot;&quot; Password=&quot;&quot; PeriodicInformEnable=&quot;1&quot; PeriodicInformInterval=&quot;43200&quot; PeriodicInformTime=&quot;&quot; ParameterKey=&quot;0&quot; ConnectionRequestURL=&quot;&quot; ConnectionRequestUsername=&quot;&quot; ConnectionRequestPassword=&quot;&quot; UpgradesManaged=&quot;0&quot; KickURL=&quot;&quot; DownloadProgressURL=&quot;&quot; DefaultActiveNotificationThrottle=&quot;0&quot; UDPConnectionRequestAddress=&quot;&quot; UDPConnectionRequestAddressNotificationLimit=&quot;0&quot; STUNEnable=&quot;0&quot; STUNServerAddress=&quot;&quot; STUNServerPort=&quot;0&quot; STUNUsername=&quot;&quot; STUNPassword=&quot;&quot; STUNMaximumKeepAlivePeriod=&quot;0&quot; STUNMinimumKeepAlivePeriod=&quot;0&quot; NATDetected=&quot;0&quot; ManageableDeviceNumberOfEntries=&quot;0&quot; ManageableDeviceNotificationLimit=&quot;0&quot; X_HW_EnableCertificate=&quot;0&quot; X_HW_CertPassword=&quot;$1H|^RWDa;}+O9_21&amp;gt;V61.,&amp;amp;!!$&quot; X_HW_DSCP=&quot;0&quot; X_HW_CheckPasswordComplex=&quot;0&quot;/&gt;</pre><h4>Power Management:</h4><pre>&lt;X_HW_APMPolicy EnablePowerSavingMode=&quot;1&quot;&gt;<br>&lt;BatteryModePolicy NotUseUsbService=&quot;0&quot; NotUseLanService=&quot;0&quot; NotUseWlanService=&quot;0&quot; NotUseVoiceService=&quot;0&quot; NotUseCATVService=&quot;0&quot; NotUseRemoteManagement=&quot;0&quot;/&gt;<br>&lt;/X_HW_APMPolicy&gt;</pre><h4>Custom Info:</h4><pre>&lt;X_HW_ProductInfo originalVersion=&quot;V300R015C10SPC115A0006290141&quot; currentVersion=&quot;V300R015&quot; customInfo=&quot;COMMON&quot; customInfoDetail=&quot;common&quot;/&gt;</pre><h3>Modify The Configuration:</h3><p>I modified the configuration file and enabled certain services which I wanted to explore further. These configrautoins could also be modified from the WebUI but Hey! we are cool so we will do it the hard way. To do that I fired up my all time favourite text editior, <strong>VIM </strong>modified the configuration file and changed these configurations:</p><h4>IP Address:</h4><p>Disabled the 2nd IP address by changing “Enable=1” to “Enable=0”.</p><h4>Services:</h4><p>Changed 0 to 1 for: <strong><em>FTPLanEnable= “1” TELENETLanEnable= “1” SSHLanEnable= “1”</em></strong></p><h4>Account:</h4><p>Add a new attribute before <strong><em>&lt;X_HW_CLITelnetAccess/&gt;</em> </strong>the new attribute will be:</p><pre>&lt;X_HW_CLISSHControl Enable=&quot;1&quot; port=&quot;22&quot; Mode=&quot;0&quot; AluSSHAbility=&quot;0&quot;/&gt;</pre><p>This will enabled SSH CLI access on the device. The final configuration will look something like this:</p><pre>&lt;UserInterface&gt;<br>&lt;X_HW_CLIUserInfo NumberOfInstances=&quot;1&quot;&gt;<br>&lt;X_HW_CLIUserInfoInstance InstanceID=&quot;1&quot; Username=&quot;root&quot; Userpassword=&quot;465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac&quot; UserGroup=&quot;&quot; ModifyPWDFlag=&quot;0&quot; EncryptMode=&quot;1&quot;/&gt;<br>&lt;/X_HW_CLIUserInfo&gt;<br>&lt;X_HW_CLISSHControl Enable=&quot;1&quot; port=&quot;22&quot; Mode=&quot;0&quot; AluSSHAbility=&quot;0&quot;/&gt;<br>&lt;X_HW_CLITelnetAccess Access=&quot;1&quot; TelnetPort=&quot;23&quot;/&gt;<br>&lt;X_HW_WebUserInfo NumberOfInstances=&quot;2&quot;&gt;<br>&lt;X_HW_WebUserInfoInstance InstanceID=&quot;1&quot; UserName=&quot;root&quot; Password=&quot;465c194afb65670f38322df087f0a9bb225cc257e43eb4ac5a0c98ef5b3173ac&quot; UserLevel=&quot;1&quot; Enable=&quot;1&quot; ModifyPasswordFlag=&quot;0&quot; PassMode=&quot;2&quot;/&gt;<br>&lt;X_HW_WebUserInfoInstance InstanceID=&quot;2&quot; UserName=&quot;telecomadmin&quot; Password=&quot;402931e04c03e24d360477a9f90b9eb15777e154360f06228be15c37679016ef&quot; UserLevel=&quot;0&quot; Enable=&quot;1&quot; ModifyPasswordFlag=&quot;0&quot; PassMode=&quot;2&quot;/&gt;<br>&lt;/X_HW_WebUserInfo&gt;<br>&lt;X_HW_WebSslInfo Enable=&quot;0&quot; CertPassword=&quot;$1x&amp;apos;&amp;apos;b)e,hq4.xt@!30zkA,&amp;amp;!!$&quot;/&gt;<br>&lt;/UserInterface&gt;</pre><h4>FTP:</h4><p>Change <strong>FtpEnable= “1”</strong> and <strong>FtpRoorDir= “/mnt/jffs2/”</strong></p><pre>&lt;X_HW_SebrviceManage FtpEnable=&quot;1&quot; FtpPort=&quot;21&quot; FtpRoorDir=&quot;/mnt/jffs2/&quot; FtpUserNum=&quot;0&quot;/&gt;</pre><h4>Remote Management:</h4><p>Disable Remote Management <strong>EnableCWMP = “0”</strong></p><h4>Power Management:</h4><p>Disable power management <strong>EnablePowerSavingMode= “0” </strong>this will configure the ONT for maximum performance.</p><pre>&lt;X_HW_APMPolicy EnablePowerSavingMode=&quot;0&quot;&gt;<br>&lt;BatteryModePolicy NotUseUsbService=&quot;0&quot; NotUseLanService=&quot;0&quot; NotUseWlanService=&quot;0&quot; NotUseVoiceService=&quot;0&quot; NotUseCATVService=&quot;0&quot; NotUseRemoteManagement=&quot;0&quot;/&gt;<br>&lt;/X_HW_APMPolicy&gt;</pre><p>Now upload the updated configuration file to the ONT and let it restart.</p><p>Once the device is running again check for the open ports on the ONT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Xtfbe_fhv_72ax3REoJ-g.png" /><figcaption>Open ports</figcaption></figure><p>Now lets login via SSH. The credentials for SSH will be either <strong>root:admin </strong>or <strong>root:adminHW. </strong>In my the first credetials worked.</p><pre>WAP&gt;?<br>amp add policy-stats pon<br>amp add policy-stats port<br>amp add stats gemport<br>amp clear policy-stats pon<br>amp clear policy-stats port<br>amp clear stats gemport<br>amp debug lswtable all<br>amp del policy-stats pon<br>amp del policy-stats port<br>amp del stats gemport<br>amp display efc<br>amp display l2act<br>amp display l2mac<br>amp display sfc<br>amp display userflow<br>amp show<br>ampcmd show car all<br>ampcmd show car index<br>ampcmd show emac stat<br>ampcmd show flow all<br>ampcmd show flow index<br>ampcmd show log<br>ampcmd show queue all<br>ampcmd show queue index<br>ampcmd trace all<br>ampcmd trace cli<br>ampcmd trace dpoe<br>ampcmd trace drv<br>ampcmd trace emac<br>ampcmd trace emap<br>ampcmd trace eth<br>ampcmd trace gmac<br>ampcmd trace gmap<br>ampcmd trace onu<br>ampcmd trace optic<br>ampcmd trace qos<br>bbsp add policy-stats btv<br>bbsp clear policy-stats btv all<br>bbsp clear policy-stats wan<br>bbsp del policy-stats btv<br>bbspcmd<br>Broadband debug<br>Broadband display<br>Broadband stat<br>chipdebug<br>clear amp pq-stats<br>clear file<br>clear lastword<br>clear pon statistics<br>clear poncnt dnstatistic<br>clear poncnt gemport upstatistic<br>clear poncnt upstatistic<br>clear port statistics<br>collect debug info<br>component delete all<br>debug dsp down msg<br>debug dsp msg<br>debug dsp up msg<br>debug ifm<br>debug qoscfg<br>debug rtp stack<br>debug sample mediastar<br>display access mode<br>display amp policy-stats pon<br>display amp policy-stats port<br>display amp pq-stats<br>display amp stats gemport<br>display apmChipStatus<br>display batteryStatus<br>display bbsp stats btv<br>display bbsp stats wan<br>display bmsxml crc<br>display boardItem<br>display cwmp debug<br>display debug info dhcp6c<br>display debug info dhcp6s<br>display debug info pppoev6<br>display debug info ra<br>display deviceInfo<br>display dhcp_em result<br>display dsp channel para<br>display dsp channel running status<br>display dsp channel status<br>display dsp chip stat<br>display dsp codec status<br>display dsp interrupt stat<br>display epon ont info<br>display ethoam ma info<br>display ethoam md info<br>display ethoam mep info<br>display ethoam mep perf<br>display file<br>display filter rf<br>display flashlock status<br>display flow<br>display inner version<br>display jb grid status<br>display jb para<br>display lanmac<br>display lastword<br>display log info<br>display macaddress<br>display machineItem<br>display memory info<br>display msg-queue<br>display oaml2shell ethvlan<br>display onu info<br>display optic<br>display optmode<br>display patch information<br>display pon statistics<br>display poncnt dnstatistic<br>display poncnt gemport upstatistic<br>display poncnt upstatistic<br>display portstatistics<br>display pppoe_em result<br>display productmac<br>display progress load<br>display rf config<br>display rtp stack channel stat<br>display rtp stack chip stat<br>display rtp stack para<br>display rtp stack version<br>display sn<br>display startup info<br>display swm bootstate<br>display swm state<br>display sysinfo<br>display syslog<br>display timeout<br>display timer<br>display usb devList<br>display version<br>display wan layer all<br>display wanmac<br>display wifi multicast<br>display wifi pa type<br>display wifichip<br>display wlanmac<br>display zsp version<br>get battery alarm status<br>get ip conntrack<br>get iptables filter<br>get iptables mangle<br>get iptables nat<br>get iptables raw<br>get mac agingtime<br>get ont oamfrequency<br>get opm switch<br>get optic debug info<br>get optic par info<br>get optic txmode<br>get poncnt upgemport<br>get port config<br>get port isolate<br>get port vlan<br>get rogue status<br>get testself<br>get vlan auth<br>get wlan advance<br>get wlan associated<br>get wlan basic<br>get wlan enable<br>get wlan stats<br>get wlan txpower<br>get wlan wps<br>ifconfig<br>igmp clear statistics<br>igmp get debug switch<br>igmp get flow info<br>igmp get global cfg<br>igmp get iptv<br>igmp get multilmac<br>igmp get port multicast config<br>igmp get statistics<br>igmp set debug switch<br>ip -6 neigh<br>ip -6 route<br>ip -6 rule<br>ip neigh<br>ip route<br>ip rule<br>load pack<br>logout<br>make ssh hostkey<br>mgcp mg-config<br>mgcp mgc 1<br>mgcp mgc 2<br>mid get<br>mid off<br>mid set<br>napt cli<br>netstat -na<br>oamcmd clear log<br>oamcmd debug<br>oamcmd error log<br>oamcmd pdt show log<br>oamcmd show flow<br>oamcmd show log<br>omcicmd alarm show<br>omcicmd clear log<br>omcicmd debug<br>omcicmd error log<br>omcicmd mib show<br>omcicmd pdt show log<br>omcicmd pm show<br>omcicmd show flow<br>omcicmd show log<br>omcicmd show qos<br>omcicmd show tcont table<br>ping<br>qoscfg get<br>quit<br>reset<br>restore manufactory<br>route get default<br>save data<br>save log<br>set cwmp debug<br>set ethportmirror<br>set led<br>set opticdata<br>set port isolate<br>set ringchk<br>set timeout<br>set userpasswd<br>set voicedebug<br>set voicedsploop<br>set voicelinetest<br>set voiceportloop<br>set voicesignalingprint<br>setconsole<br>stats clear<br>stats display<br>su<br>traceroute<br>voice remote diagnose server set<br>voice remote diagnose set<br>vspa clear rtp statistics<br>vspa debug<br>vspa display conference info<br>vspa display dsp running info<br>vspa display dsp state<br>vspa display mg if state<br>vspa display mg info<br>vspa display mgcp config<br>vspa display online user info<br>vspa display port status<br>vspa display rtp statistics<br>vspa display service log<br>vspa display signal scene info<br>vspa display signal scene list<br>vspa display user call state<br>vspa display user status<br>vspa mgc switch<br>vspa reset<br>vspa shutdown mg<br>wap list<br>wap ps<br>wap top<br>WAP&gt;</pre><p>We got access to the WAP shell. It must be noted that WAP shell is different from the linux shell. <strong>su </strong>and <strong>shell </strong>commands looks interesting lets explore it further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*2UPjQmcjze5YGjIm_Z66VA.png" /></figure><p>we can only run 3 commands :(</p><p>However if I return to the WAP CLI and enter the following command I can explore the directories:</p><pre>wap list path /<br>wap list path /bin/</pre><p>For further exploration I need to extract the content from the NAND but unfortunately in the mean time I don’t a proper NAND redear to perform this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*d5w7GXwYw37UtCxr9NlEHg.png" /></figure><h3>Chnaging Master Account Password:</h3><p>Changing the master account username and password isn’t straight forward because it is kinda hidden user and mostly used by the ISPs to manage and configure the router sometimes ISPs can even remotely manage your router/ONT becuase they have the master account and you are already connected to their network alothough it is via fiber. To change your password follow these steps:</p><ul><li>Convert your new password in MD5 hash. For example md5 sum for <strong>“testpassword” </strong>is <strong>“e16b2ab8d12314bf4efbd6203906ea6c”.</strong></li><li>Copy this MD5 hash and hash it once again but this time in SHA256. So the final hash for <strong>“testpassword” </strong>will be &quot;2e2d3e9f6c92c83054cc339ca1357d834865317050808ab8efd81af5e2796a0e&quot;.</li><li>Now replace the final hash in the configuration file and upload the configuration file to the device.</li></ul><h3>Final Thoughts:</h3><p>With current rights and access we can’t do much with the ONT just basic stuff like changing the ISP provided DNS server, Changing the Master Account Password or enabling the Cable TV if your version of the ONT supports it. But customizing the firmware or disabling or enabling some extra features will not be possible at this stage.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=710b2e4d5d3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up Android (Android 10+) Pentest Lab on Windows]]></title>
            <link>https://daniyal48.medium.com/setting-up-android-android-10-pentest-lab-on-windows-9c85e195a1fc?source=rss-1a9e9ba7494b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c85e195a1fc</guid>
            <category><![CDATA[objection]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[frida]]></category>
            <category><![CDATA[burpsui]]></category>
            <category><![CDATA[guide]]></category>
            <dc:creator><![CDATA[Daniyal Shahzad]]></dc:creator>
            <pubDate>Thu, 12 Sep 2024 08:35:55 GMT</pubDate>
            <atom:updated>2024-09-21T14:29:25.284Z</atom:updated>
            <content:encoded><![CDATA[<h3>Problem:</h3><p>Android 10 came with security enahncements and a lot of features. This is where the problem begins because in Android 10 and above one cannot mount the system partition with read/write permissions and to setup the Pentest lab on an emulator or a physical device you need to install burp suite CA certificate on your device this enables Burp to impersonate the target webserver during the TLS handshake resulting in the reading and modification of HTTP and HTTPS traffic. In the lower version of Android you could easily make Android to trust the CA certificate but that is not the case in Adnroid 10 because you can not even move the CA Certifiacte to System Partition. In this blog I will briefly explain how you can setup an Android Penting Lab on Android 10+ and Installing Frida-tools and Objection on your device.</p><h3>Requirements:</h3><ul><li>Rooted Android (You can follow my <a href="https://medium.com/@daniyal48/root-android-devices-with-magisk-6276abc5e21">guide</a> how to root your device)</li><li>Burpsuite</li><li>Python</li><li>Frida Server</li><li>Frida-Tools</li><li>Objection</li></ul><h4><strong>Understanding Frida-Tools:</strong></h4><p><strong>Frida-tools</strong> is a set of utilities and tools built around <strong>Frida</strong>, a dynamic instrumentation toolkit that allows developers and security researchers to inject scripts into running applications for analysis and manipulation. It is widely used in security research, reverse engineering, and penetration testing to interact with, hook, and manipulate the behavior of programs on various platforms (e.g., Android, iOS, Windows, macOS, Linux).</p><h4>What is Objection:</h4><p><strong>Objection</strong> is a powerful runtime mobile exploration toolkit, built on top of <strong>Frida</strong>, designed to simplify the process of security testing and penetration testing of Android and iOS applications. It allows testers to bypass security mechanisms, inspect and manipulate apps, and perform tasks like bypassing SSL pinning, exploring app data, or interacting with an app’s internals — <strong>without needing to modify the app’s binary or have root access.</strong></p><h4>What if Frida Server:</h4><p><strong>Frida Server</strong> is a core component of the <strong>Frida</strong> instrumentation framework that runs on the target device (such as an Android or iOS device) and enables communication between the device and your local machine where you’re running Frida commands or scripts.</p><h3>Guide:</h3><p>Once you have got your Android devices rooted and installed BurpSuite can get started.</p><p>First of all we need to install Frida, Frida Server and Objection.</p><ul><li>Open terminal/comman prompt and check if you have python installed.</li></ul><figure><img alt="Command prompt where python — version command is entered to check if python is installed or not. If the command runs it will output the python version" src="https://cdn-images-1.medium.com/max/396/1*k-WQx9REwHoX3YxC-7P_og.png" /><figcaption>Cheking Python Version</figcaption></figure><ul><li>Now install frida-tools with pip command</li></ul><pre>pip install frida-tools</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1NEBU2WqIeu3QiVZnUmdGQ.png" /><figcaption>Installing Frida-Tools</figcaption></figure><ul><li>Then install Objection using pip</li></ul><pre>pip install objection</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m7Rho0SDGu25dsYS8S8oUQ.png" /><figcaption>Installing Objection</figcaption></figure><ul><li>Once you have these installed, find their paths and then add those paths to your environment variables.</li></ul><pre>pip show frida-tools<br>pip show objection</pre><ul><li>In my case the path was:</li></ul><pre>C:\Users\dshah\AppData\Roaming\Python\Python312\Scripts</pre><ul><li>Now search for environment variables and add this path.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*EqfoW4F6Je2MCQtKWEbijA.png" /><figcaption>Search for Environment variables</figcaption></figure><ul><li>Click the Environment Variables Button</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*9g7vGaAQ0eGXE41s8Lrz_Q.png" /><figcaption>System Properties Window</figcaption></figure><ul><li>Now a new window will open. Select the Path variable there and click edit.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*83SKZCS5akYyPmXzC8w4bQ.png" /><figcaption>Modifying Path</figcaption></figure><ul><li>A third window will open and there select the new button and paste the path to frida-tools and objection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Ip_Xm3xi_XNbAq3hCg_6Ag.png" /><figcaption>Adding new path</figcaption></figure><ul><li>Once you have done this part come back to the terminal and run frida and objection to verify that you paths were added successfuly.</li></ul><pre>frida ps<br>objection</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*f5kTMb7kZpz6rgOzOzTZDQ.png" /><figcaption>Frida Command result</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*9Oa6I_rJOyrYfNnrWDel3g.png" /><figcaption>Objection Command Results</figcaption></figure><ul><li>For frida-server we have to get the right architecture for our Android Device but as we are working on Android 10+ most of the devices are using ARM64 architecture but just for an idea here is how to do it.</li><li>Connect your device to you PC through a USB cable and allow USB Debugging permission to your PC from your Android Device.</li><li>Run adb shell commands to get the architecture</li></ul><pre>adb shell<br>getprop ro.prodcut.cpu.abi</pre><ul><li>The first command will give you an interactive shell to your Android Device and the second command will get the System Architecture.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*chzRYs3rknnece_8gwtuCA.png" /><figcaption>System Architecture</figcaption></figure><ul><li>Next download frida server for your device from here <a href="https://github.com/frida/frida/releases">https://github.com/frida/frida/releases</a>. There are too many releases make sure to list down all the available downloads and get the relevent.</li><li>Extract the file and transfer it to your android device.</li></ul><pre>adb push frida-server-16.4.10-android-arm64 /sdcard/frida-server</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-CrEGalhf117AztRLg7Og.png" /><figcaption>Copy frida-server to your Android</figcaption></figure><ul><li>The next step is to install BurpSuite Certificates. Launch BurpSuite and export the ceritificate.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cETpZGKRaY8QOSFrYKT-Xg.png" /><figcaption>Open Proxy Settings</figcaption></figure><ul><li>First add another proxy in the proxy settings which will listen on the IP address which is visible to your Android device and another port than 8080 since it is already in use. Or you can can listen on all interfaces.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Imr67NGosu0w1i8-NvKsqg.png" /><figcaption>Adding a new Proxy Listener</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*Eu-mgr1UiAAeRgWuIvqS8w.png" /><figcaption>Added a new proxy listener</figcaption></figure><ul><li>After this step you have to export the CA Certificate from the BurpSuite by clicking the Import/Export CA certificate button.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPLIh4YVvizyvS9cwi_hoQ.png" /><figcaption>Export CA Certificate</figcaption></figure><ul><li>Name your file and export it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*gGTXcAy7TsvofmmO9Th_ng.png" /><figcaption>CA Certificate</figcaption></figure><ul><li>Change your file extension from DER to CRT so it can be installed on Android and use adb push command to copy the CA Certificate to your device.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*hFmsxaeGzD3PjHyMS73F-Q.png" /><figcaption>CA Certificate</figcaption></figure><ul><li>Now to go to settings&gt;&gt;Security&gt;&gt;Advanced Settings&gt;&gt;Encryption and Credentials&gt;&gt;Install a Certificate&gt;&gt; CA Certificate (on Android).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*QEpIapTFvPiCXysze_1kQQ.png" /><figcaption>CA Certificate Instalation prompt</figcaption></figure><ul><li>Select Install anyway and then Select your CA Certificate from your storage you just copied from your PC.</li><li>Now the Certificate is installed but it will not work with Burpsuite becuase it isn’t trusted by the system and it is a user certificate.</li><li>To copy it to system certificates Download <strong>MagiskTrustUserCerts </strong>from here <a href="https://github.com/NVISOsecurity/MagiskTrustUserCerts">https://github.com/NVISOsecurity/MagiskTrustUserCerts</a> and install it via Magisk and reboot your device.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*sZjlsPF1VAubUFMTFzGXBQ.png" /><figcaption>Module Installed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*dxqt8o0Nu-5LrpVGXzc9Vw.png" /><figcaption>CA Certificate Installed</figcaption></figure><h3>Probelms</h3><p>This solution only works till Android 13 and there were some changes in Android 14 and this method doesn’t work furhter moreover you might face random restarts on your Android while using the latest Frida-tools and Frida Server this can be solved by downgrading frida-Server to 15.2.2 and Frida-tools to 11.0.0 and this should resolve the issue.</p><p>If you see the following error while running frida-server on your device:</p><pre>{&quot;type&quot;:&quot;error&quot;,&quot;description&quot;:&quot;Error: Unable to perform state transition; please file a bug&quot;,&quot;stack&quot;:&quot;Error: Unable to perform state transition; please file a bug\n    at bt (frida/node_modules/frida-java-bridge/lib/android.js:578:1)\n    at frida/node_modules/frida-java-bridge/lib/class-model.js:112:1\n    at Function.build (frida/node_modules/frida-java-bridge/lib/class-model.js:7:1)\n    at k._make (frida/node_modules/frida-java-bridge/lib/class-factory.js:168:1)\n    at k.use (frida/node_modules/frida-java-bridge/lib/class-factory.js:62:1)\n    at frida/node_modules/frida-java-bridge/index.js:224:1\n    at c.perform (frida/node_modules/frida-java-bridge/lib/vm.js:12:1)\n    at _performPendingVmOpsWhenReady (frida/node_modules/frida-java-bridge/index.js:223:1)\n    at _.perform (frida/node_modules/frida-java-bridge/index.js:204:1)\n    at /internal-agent.js:490:6&quot;,&quot;fileName&quot;:&quot;frida/node_modules/frida-java-bridge/lib/android.js&quot;,&quot;lineNumber&quot;:578,&quot;columnNumber&quot;:1}</pre><p>run the following command in adb shell to solve the issue:</p><pre>pm uninstall com.google.android.art</pre><h3>Conclusion:</h3><p>This step-by-step blog was about setting up the lab to get started with Android Applications pentesting this doesn’t guide you to how to bypass root or SSL Pinning that will be added later into this story. This covers and solves the most annoyiong problem of installing BurpCertificate. I hope you find this blog helpful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c85e195a1fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Firmware Extraction and Rooting Simplified for Sony Xperia 10 IV.]]></title>
            <link>https://daniyal48.medium.com/firmware-extraction-and-rooting-simplified-for-sony-xperia-10-iv-1aee4caf99aa?source=rss-1a9e9ba7494b------2</link>
            <guid isPermaLink="false">https://medium.com/p/1aee4caf99aa</guid>
            <category><![CDATA[firmware]]></category>
            <category><![CDATA[imei]]></category>
            <category><![CDATA[sony-xperia]]></category>
            <category><![CDATA[diagnostic]]></category>
            <category><![CDATA[patch]]></category>
            <dc:creator><![CDATA[Daniyal Shahzad]]></dc:creator>
            <pubDate>Thu, 13 Jun 2024 21:10:53 GMT</pubDate>
            <atom:updated>2024-06-13T21:17:58.960Z</atom:updated>
            <content:encoded><![CDATA[<h3>Contents:</h3><p>I have mentioned shortcuts to all the section so you can easily skip to the section which you are interested in without wasting your time in scrolling or any other useless information.</p><p><a href="#d01c">Background</a><br><a href="#bcfc">Unlocking the Bootloader</a><br><a href="#3f07">Getting the firmware (official)</a><br><a href="#117b">Extracting the boot.img file</a><br><a href="#eb0e">Rooting Process</a><br><a href="#e558">Conclusion</a></p><h3>Background:</h3><p>Recently I got my hands on a Sony Xperia 10 IV and was using it for some testing purposes and I had to enable the diagnostic port for some kind of firmware extraction from the WiFi module used in this device. But to enable diagnostic port I had to get in to the service mode of the device which is not directly possible (by dialing codes from the phone dialer that we usually see on Samsung phones). To get to the diag port on the device I needed to root the device first. Now, from here the loops start and stick with me its going to a fun one 😂. To root the device you have to unlock the bootloader, for bootloader unlock you have to generate codes and after all these steps you have to get your hands on the official firmware, extract the boot image and patch it with Magisk.</p><p>Unlocking the bootloader on Sony Xperia is a headache. Let me explain why?</p><ul><li>Windows 11 can’t install the fastboot drivers for the Sony Xperia 10 IV even though I downloaded the official drivers. Had to switch between Linux and Windows. You will get an idea in the later part why I had to switch back to windows.</li><li>Getting into the bootloader is different than we normally see on other Android Devices.</li><li>Bootloader menu doesn’t have a UI, you have to look at the LED on the front and recognize if you are in the fastboot mode or not.</li></ul><h3>Unlocking the Bootloader:</h3><p>To unlock the bootloader on Sony Xperia 10 IV, Follow these steps:</p><ol><li>If you have come to this article I assume you already know how to enable the developer options. So I am skipping that part.</li><li>Enable <strong>OEM Unlocking</strong> from the Developer options menu.</li><li>Note down you device IMEI or Serial Number.</li><li>Shutdown you device completely.</li><li>Once your device is completely shutdown, Press and hold the Volume Up button and connect your device with your computer and keep holding the Volume Up button and then press the power button until the LED on the top turns blue.</li><li>Generate unlock code from <a href="https://developer.sony.com/open-source/aosp-on-xperia-open-devices/get-started/unlock-bootloader">here.</a></li><li>Once your device is detected by fastboot, type the following command:</li></ol><pre>$fastboot oem unlock 0x&lt;Your_Key&gt;<br>or<br>$fastboot oem unlock &lt;Your_Key&gt;</pre><p>8. Once this is done, Unplug you device and it should restart.</p><p>9. Once the device is booted set it up for the next step.</p><h3>Getting the Firmware (Official)</h3><ol><li>You can either use a firmware from a 3rdParty website or from Sony’s Original tool called <strong>Emma</strong>.</li><li>I will recommend using <strong>Emma</strong> (Its fun and trusted too).</li><li>Download and Install <strong>Emma</strong> from <a href="https://developerworld.wpp.developer.sony.com/file/download/download-the-flash-tool/">here.</a> The reason I had to switch from windows to Linux and vice versa because <strong>Emma</strong> is only supported by Windows. (Yes I know you can run executables on Linux but I was short on time)</li><li>Now Shutdown you device again and this time put it in <strong>Flash Mode.</strong></li><li>Keep pressing the Volume Down Key and connect you device with your computer and then press the Power Button too until the LED turns green.</li><li>Check <strong>Emma</strong> and your device should be visible there.</li><li>Download and Flash the latest available firmware for your device.</li><li>Once the flashing is done, go through the device setup process and enable USB Debugging again.</li><li>Open the path mentioned below in your PC:</li></ol><pre>C:\\ProgramData\\Sony\\Xperia Flash Tool\\&lt;Date_Time_Named_Folder&gt;\\localstorage\\Default</pre><p>10. If you don’t see <strong>Program Data</strong> folder, you are screwed 😮, Just kidding <strong>Enable Hidden Items</strong> from the <strong>View Menu</strong> of windows <strong>File Explorer</strong> and you are good to go.</p><p>11. Copy your files to a safe directory and move to the next section.</p><h3>Extracting the Boot.img File:</h3><ol><li>Once you copy the directory, look for the files and you will see that there are files which name starts from something <strong>FILE_&lt;some_number&gt;.</strong></li><li>Open the file with the largest file size using 7zip File Manager. It is important to note that these files can not be opened directly as they have no file extension.</li><li>Next look for the <strong>boot_X-FLASH-ALL-5904.sin</strong> file and open it.</li><li>You should see <strong>boot.000</strong> file.</li><li>Extract this file and change the .000 extension with <strong>.img.</strong></li><li>Copy this file to your device.</li></ol><h3>Rooting Process:</h3><ol><li>Install Magisk or Magisk Delta on your device.</li><li>Patch the boot.img with magisk and copy the patched file back to your PC (TWRP method doesn’t work as there is no TWRP image available for the <strong>Sony Xperia 10 IV)</strong></li><li>Now boot your device back into <strong>Fastboot mode.</strong></li><li>Use the following command to flash the patched <strong>boot.img</strong> file. You can not test the patched boot image file as Sony doesn’t support <strong>fastboot boot</strong> command.</li></ol><pre>$fastboot flash boot magisk_patched_file.img</pre><p>5. Reboot your device and you can now access root shell on you device.</p><h3>Conclusion:</h3><p>Many Android devices uses the same easy method for device rooting process but some vendors are very strict about rooting and unlocking their devices. Sony Xperia 10 IV is one of them. This write-up was just a basic idea and further details will be added to this story with time.</p><p>There are certain additions I will be making to this story such as:</p><ol><li>Diag port access.</li><li>Sim Lock and Unlock methods (just for educaitonal and experimentational purposes)</li><li>Exploring the NV items of the phone.</li><li>Finding and fixing the device identifiers e.g IMEI, MAC, Serial Number etc.</li><li>Looking at the supported cellular bands.</li><li>Adding screenshots to the process.</li></ol><p>So keep visiting this story if you want to learn and experiment something new.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1aee4caf99aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hosting a website on TOR (Linux)]]></title>
            <link>https://daniyal48.medium.com/hosting-a-website-on-tor-linux-30a52a3ae7a1?source=rss-1a9e9ba7494b------2</link>
            <guid isPermaLink="false">https://medium.com/p/30a52a3ae7a1</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[tor]]></category>
            <category><![CDATA[darkweb]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Daniyal Shahzad]]></dc:creator>
            <pubDate>Wed, 27 Sep 2023 13:12:48 GMT</pubDate>
            <atom:updated>2023-10-04T17:29:35.212Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>NOTE: This method of getting vanity is only applicable to V2. I will soon update this blog for V3. Only work around to test is Downgrade your browser.</blockquote><p>I had a lot of guys asking How can I host a website on TOR with my own custom domain name?. There are some issues invloved while hosting a TOR website. The solutions to those problems are already available on the internet but not in one place. I thought why not I solve all those errors myself and give a proper and streamline solution to this question?.</p><p>In this tutorial I will be using:</p><ul><li>Raspberry Pi running Raspbian (I am using lite version you are free to use any)</li><li>An ethernet cable.</li><li>Micro SD Card (32 GB recommended)</li><li>Micro SD Card reader</li><li>Micro USB Cable to <strong>bake</strong> the Pi 😜</li><li>And a bunch of Linux Commands</li></ul><h3>Cook the Pi:</h3><p>Download the <strong>Raspberry Pi Imager </strong>from<strong> </strong><a href="https://www.raspberrypi.com/software/"><strong>here</strong></a><strong>. </strong>Now install Raspberry Pi Imager and launch it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*K41aJle7LzMtxDWSPtxUfg.png" /><figcaption>Raspberry Pi Imager welcome screen</figcaption></figure><p>Now select the Operating System you want to install on your Pi (Adding ingredients to the Pi). The page should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*DPPe-6Y-shZIfRJCi6iO2A.png" /><figcaption>Choose OS Screen (Raspberry Pi Imager)</figcaption></figure><p>Once you select the OS, select your Storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*b-XuZRnjWVskl7RJ1tchlw.png" /><figcaption>Storage Selection Screen</figcaption></figure><p>Once done we have to setup some basic configurations on Pi, for example <strong>Connection Settings, SSH and Hostname</strong> etc.</p><h3>Setup:</h3><p>Now you will a gear icon for settings to setup some basic configurations. Now I will go walkthrough those settings with <strong>Raspberry Pi Imager </strong>automated method and also Manual method becuase sometimes Raspberry Pi images method doesn’t work and being an old school person I like the manual method.</p><h4>Raspberry Pi Imager method:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*Zrl776ggSnawleTnTO2L7g.png" /><figcaption>Advanced Options</figcaption></figure><p>Configure all the settings according to your specifications. Once configurations are done, save these configurations and start the baking process 😋 <strong>(Burning process).</strong></p><p>As soon as the Pi is cooked (Flashing is done) serve it by inserting the SD Card in the Pi and connecting the USB cable to the power source. If you have added the wireless ingredient in it (enabled wireless in the advanced options), you should be able to discover the Pi on the table (on your network).</p><h4>Problem:</h4><p>The problem with wireless method is that it will be a bit difficult to discover the Pi on the network. You might need to scan the whole network with a network discovery tool such as <a href="https://angryip.org/"><strong>Angry IP scanner</strong></a><strong> </strong>or <a href="https://nmap.org/download.html"><strong>namp</strong></a><strong>.</strong></p><p>But unfortunately my Pi wasn’t discovered on the network. So I will be using the manual method, for that we will need an ethernet cable.</p><h4>Manual Method (Headless Mode) :</h4><ul><li>Take out the SD Card from the Pi.</li><li>Insert the Card back into SD Card reader and connect it to your system</li></ul><p>Once connected you should see the a new <strong>boot </strong>partition on your system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*r6ht-UvZDj-uQv0hrPN2sw.png" /><figcaption>Raspberry Pi partition</figcaption></figure><ul><li>Now go to this partition and create a new file with <strong>“ssh” </strong>name having no file extension.</li><li>Now connect the raspberry Pi to your computer via ethernet cable</li><li>Use your ssh client to connect to Pi. I am using <a href="https://www.putty.org/"><strong>Putty</strong></a><strong>. </strong>This is called <strong>Headless Mode.</strong></li><li>Use your raspberry Pi hostname as Hostname and leave the ssh port as default i.e. Port 22.</li><li>In my case it looks something like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*HTgeZmrZpll3JXPXDrL4lg.png" /><figcaption>Connecting to raspberry Pi.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*G9JSh-WYBCKzWeZFm_DbCA.png" /><figcaption>Connection to Raspberry Pi</figcaption></figure><p>With <strong>ifconfig </strong>Command we can see that if our Pi is connected to our wireless network and find it’s IP address, but like I said earlier the automated method gives issues sometimes as you can see our Pi is not connected to the Wireless network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*aBpxxJFOQT5bE95u7sYEWA.png" /><figcaption>Command output</figcaption></figure><p>Now configure the Wifi to get access the internet and get rid of this ethernet cable too.</p><h4>Wireless Configuration:</h4><ul><li>Enter the command <strong><em>“sudo raspi-config”.</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*4zsgjX-n9G9waaCS8WTEuQ.png" /><figcaption>Raspberry Pi configuration</figcaption></figure><ul><li>Here you can configure other system settings too.</li><li>Select <strong><em>“System Options”</em> </strong>in the list.</li><li>Then select <strong><em>“Wireless LAN”.</em></strong></li><li>Enter your <strong>SSID</strong> and <strong>Password.</strong></li><li>Use <strong><em>“ifconfig”</em></strong> command again to check your wireless connection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*RsjmeBvTI02Z_1zPyLej7w.png" /><figcaption>Raspberry Pi wireless connection</figcaption></figure><ul><li>Note your IP and disconnect the Ethernet cable (if you want to).</li><li>Reconnect using the wireless IP.</li></ul><h3>Hosting your website:</h3><h4>Installing Packages:</h4><ul><li>Run <strong><em>“sudo apt update” </em></strong>Command to update your packages</li><li>You can leave it as it is or run <strong><em>“sudo apt upgrade” </em></strong>to upgrade the packages as well.</li><li>Now run <strong><em>“sudo apt install tor”.</em></strong></li></ul><h4>Configurations:</h4><ul><li>Edit the <strong>“torrc” </strong>file. <strong><em>“sudo nano /etc/tor/torrc”</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*yLxeX5z6VlnIO4hQ6dNNnw.png" /><figcaption>torrc file</figcaption></figure><p>Once the file is open. scroll down until you found the following lines and uncomment them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*RYis1NyVarlf0Lg5M9_XVQ.png" /><figcaption>Lines to be uncommented</figcaption></figure><ul><li>Press <strong>Ctrl+S </strong>to save the changes and <strong>Ctrl+X </strong>close the text editor.</li><li>Now use <strong><em>“sudo service tor restart” </em></strong>to restart the tor services and load these configurations.</li><li>Use “<strong><em>sudo service tor status” </em></strong>just to make sure tor service is up and running.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*x4z3FvVzjBLv498lzqHJBA.png" /><figcaption>Tor service status</figcaption></figure><ul><li>Once this is done, Tor will assign you a random Onion address.</li><li>Use <strong><em>“sudo cat /var/lib/tor/hidden_service/hostname”.</em></strong></li><li>If you don’t see this file and directory. Create these manually</li><li><strong><em>“sudo mkdir /var/lib/tor”</em></strong></li><li><strong><em>“sudo mkdir /var/lib/tor/hidden_service”</em></strong></li><li><strong><em>“sudo touch /var/lib/tor/hidden_service/hostname”</em></strong></li><li>Now change the ownership and permissions</li><li><strong><em>“sudo chown -R raspi /var/lib/hidden_service/”</em></strong></li><li><strong><em>“sudo chmod 700 /var/lib/hidden_service/hostname”</em></strong></li><li>Now restart the tor service using <strong><em>“sudo systemctl restart tor”</em></strong></li><li>You should be able to get a hostname, <strong><em>“sudo cat /var/lib/tor/hidden_service/hostname”</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*1CuEy5mbiaED9AHfT8ecJQ.png" /></figure><ul><li>Next we install a web server you can use any web server you want. I will go with <strong>nginx </strong>because <strong>apache </strong>web server throws some undervoltage error on <strong>raspberry pi </strong>but it should work normally on Desktop.</li><li>Start the <strong>nginx </strong>service with <strong><em>“sudo service nginx start”</em></strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*zj9YS5QtL6zSJUiVv16ckQ.png" /><figcaption>Nginx start and status</figcaption></figure><ul><li>Now visit the onion address you got from <strong>hostname </strong>file and you should see your page.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*hZ5ibk3ZCLIetzqDLuPp-w.png" /><figcaption>Dark Webpage</figcaption></figure><h4>A Pinch of hardening to Nginx:</h4><p>We are going to make some changes to <strong>nginx </strong>configuration file.</p><ul><li>Do <strong><em>“sudo nano /etc/nginx/nginx.conf”.</em></strong></li><li>Uncomment the lines:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*AnB_kT-iDmHwEzMUZavV9A.png" /><figcaption>Configuration file</figcaption></figure><p>You can further customize your website by editing the file <strong>/var/www/html/index.nginx-debian.html</strong></p><h3>Setup Your Custom Domain:</h3><ul><li>Once you are done with the above steps. You can create a custom domain name.</li><li>I will be using this freely available tool on github. Thanks to the author.</li></ul><pre>git clone https://github.com/ReclaimYourPrivacy/eschalot</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*iAw3dcLMI_ziLblgKDdLHw.png" /><figcaption>Download eschalot</figcaption></figure><pre># apt install libssl-dev -y<br># cd eschalot<br># make<br># ./edchslot -vct6 -p daniel (look for the help to understand the syntax)<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*aByBh9Hj313bwRxkcx6kKg.png" /></figure><ul><li>This program will give you a private key.</li></ul><pre>cd /var/lib/tor/hidden_service<br>rm hostname<br>sudo systemctl restart tor</pre><ul><li>A new hostname file will be generated with your custom domain name.</li></ul><p>All of the above configurations only work for vanity on Onion V2 and doesn’t work on Onion V3.</p><p>The next section will explain to solve this issue and get a vanity on Onion V3 but that is a little time consuming and the name will not be as short as Onion V2 but still it’s a good initiative for exploration and learning.</p><h3>Vanity on Onion V3:</h3><ul><li>Download the following project from github thanks to the author(s) for the efforts.</li></ul><pre>git clone https://github.com/cathugger/mkp224o.git<br>sudo apt install autoconf libsodium-dev<br>cd mkp224o<br>./autogen<br>./configure<br>make<br>./mkp224o -S 5 -d onions daniel</pre><p>This will save the matching domain names to the <strong>Onions</strong> directory. Now change your directory to the <strong>Onions </strong>and you will find other directories ending with <strong>“.onion”. </strong>Change the directory with any domain name you would like and copy the files from it.</p><pre>cd &lt;domainname.onion&gt;<br>cp * /var/lib/tor/hidden_service<br>systemctl start tor<br>systemctl start nginx</pre><p>Once this is done, you should be able to visit your website through the custom domain name.</p><h3>Conslusoin:</h3><p>The main idea of the article was to experice something and play with raspberry Pi. For the time being this article is only intended for script kiddies and noobs but later on it will be updated with some theories and more descriptions. I am hoping you must have learned something new. It will be very helpful if you drop a problem in the comment box so I can make another article about it and help others to solve the problem more efficiently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30a52a3ae7a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use different User Interfaces in Kali Linux]]></title>
            <link>https://daniyal48.medium.com/how-to-use-different-user-interfaces-in-kali-linux-e9dd9933183c?source=rss-1a9e9ba7494b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9dd9933183c</guid>
            <category><![CDATA[customization]]></category>
            <category><![CDATA[gnome]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[kali-linux]]></category>
            <category><![CDATA[xfce]]></category>
            <dc:creator><![CDATA[Daniyal Shahzad]]></dc:creator>
            <pubDate>Tue, 15 Nov 2022 04:55:07 GMT</pubDate>
            <atom:updated>2022-11-15T04:55:07.882Z</atom:updated>
            <content:encoded><![CDATA[<p>Kali Linux is a penetration testing Linux distro and it is quite amazing. In the start Kali was using Gnome as it’s default user interface but in version 2019.4 Kali switched from Gnome to XFCE both are very good user interfaces. The thing I personally like about Gnome is that we can add extensions or make our own custom extensions which makes Gnome more flexible while XFCE is lighter than Gnome and it support a lot of cool things by default for example <strong>“kali-undercover” </strong>etc. I don’t know about the exact pros and cons of both UI’s because I haven’t digged in their structures and source code but if want me to do so, you can ask me in the comments of this story.</p><p>Now let’s start the process, if you are using Kali Linux in dual boot or bare metal you probably have noticed that Kali asks you to choose your user interface during the installation process. But if you are using Kali Linux in virtual machine and downloaded the VM file from Kali official website the there is a 90% chance that you are using XFCE becuase it’s the only one installed. Now if you want to install Gnome or XFCE you have to make sure that you have uncommented the repository for source packages in your <strong>“sources.list” </strong>file. The steps are:</p><ol><li>Open your terminal.</li><li>Type: <strong>sudo nano /etc/apt/sources.list</strong></li><li>And make sure that the line with <strong>“deb-src” </strong>has no<strong> “#”</strong> or space in the start.</li></ol><p>Your sources.list file should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*X1bFYOyz2ZB58OZ6oUNOZA.png" /></figure><p>Now update and upgrade your Kali, you can just update but you don’t want to have any issues right?, then do an upgrade too. Command is:</p><blockquote><strong>sudo apt update -y &amp;&amp; sudo apt upgrade -y</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*sHc6xMz0QFgYCWmeOMzNqw.png" /></figure><p>Once the upgrade is complete, we will now isntall Gnome or XFCE whichever you want.</p><p><strong>To install Gnome command willl be:</strong></p><blockquote><strong>sudo apt install -y kali-desktop-gnome</strong></blockquote><p><strong>For XFCE:</strong></p><blockquote><strong>sudo apt install -y kali-desktop-XFCE</strong></blockquote><p>During the installation you will be asked to which display manager you want to keep by default gdm3 or lightdm. Select gdm3.</p><p>Now reboot your system and when your system is booted, if you were using XFCE you will see the your welcome screen is different. Don’t login yet. You will notice a gear icon on the bottom right corner of the screen click on it and you will see multiple options. These are the user interfaces you have currently installed. Select the user interface which you want to use for the time being and log in and that’s it.</p><h3>Commands explaination:</h3><p>I have used multiple commands above I will exaplain them so can understand what we are actually doing:</p><p><strong>sudo</strong>: it is used to run a command or program with the privileges of another user. By default it uses privileges of root user. So above we are running all the commands as root.</p><p><strong>apt</strong>: APT is a pakacge manager used by debain based linux distributions. Bascially we are using APT with root permissions to do a certaint task (in our case update, upgrade and install packages)</p><p><strong>install</strong>: Install is the command for APT, Which is telling APT program what to do, so we are telling apt to install a package (in our case package is kali-desktop-xfce).</p><p><strong>update</strong>: This is another command for APT which tells APT to update the repository lists. repository is basically a storage location on a local or remote server where different pacages are placed. When we use update command APT checks the current versions of the packages installed on our system and the versions that aer currently there on the server and if the versions are higher so it tells us that we have package updates available.</p><p><strong>upgrade</strong>: This is another command where we tell the APT to download the available updates and install them on our system.</p><p><strong>-y</strong>: This is a flag which tells the APT not to ask for user agreement, We already mark the user agreement as YES.</p><p><strong>kali-desktop-xfce</strong> or <strong>kali-desktop-gnome</strong>: These are basically the packages names which are available on the repository. So in kali repositories XFCE is named as kali-desktop-xfce and so for the gnome. The package name may vary from repository to repositoy. If I were using a local repository so I could name it anything I wanted, for example best-UI, second_best-UI.</p><p>This is it. I will be happy to have your recommendations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9dd9933183c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Root Android Devices with Magisk]]></title>
            <link>https://daniyal48.medium.com/root-android-devices-with-magisk-6276abc5e21?source=rss-1a9e9ba7494b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6276abc5e21</guid>
            <category><![CDATA[android-rooting]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Daniyal Shahzad]]></dc:creator>
            <pubDate>Wed, 09 Nov 2022 15:04:44 GMT</pubDate>
            <atom:updated>2022-11-11T15:29:26.551Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog I will be discussing about rooting Android (the latest versions). Some Android devices are easy to root such as Pixel devices and some devices are very hard to root or even don’t allow rooting. I will be rooting a Pixel device in this tutorial while giving some idea how to root other android devices and restoring them to their original factory images.</p><p>WARNING!! Please make sure backup your all important data from your phone.</p><h3>What you will need:</h3><ol><li>Android Device which you want to root</li><li>Factory Image or OTA Update file</li><li><a href="https://github.com/topjohnwu/Magisk/releases/tag/v25.2">Magisk apk</a></li><li><a href="https://twrp.me/Devices/">TWRP Recovery</a></li><li><a href="https://developer.android.com/studio/releases/platform-tools">SDK Platform Tools</a></li></ol><h3>Procedure:</h3><p>First of all we need to unlock the bootloader for our device. Some vendors allow bootloader unlocking and some don’t. Some vendors require you to purchase the unlocking key so then you can unlock your device. See the unlocking method according to your device on <a href="https://forum.xda-developers.com/">XDA-Developers forum</a>.</p><p>Go to your device “<strong>settings”</strong>, then locate “<strong>about phone”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*MuEIN-Tjiy50un-d9KZWlw.png" /><figcaption>About Phone in settings</figcaption></figure><p>Now find build number and tap on it 6–7 times to unlock <strong>“developers options”</strong>. If you have a screen lock set up on your device it will require you to enter your Pin or whatever you are using.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*bpz_0SCGvs1yLuVADTiA_Q.png" /><figcaption>Build number Shows the system update currently installed on your device</figcaption></figure><p>Once done, go back and you will see new menu under<strong> “System”</strong> named “<strong>Developer Option”. </strong>Open this menu and you will see a lot of settings there, here we are interested in “<strong>OEM Unlocking”</strong> option and “<strong>Usb debugging”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*MkLZwPMGnz2E-jpKvaKNnA.png" /><figcaption>Developer Options has a lot of other features for developers</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*GCCqD796kASccCstjEOCHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*050z5USUQN8KP11vJCwRGg.png" /></figure><p>Enable both of these options.</p><p>Now, download <strong>Magisk apk</strong> from its official github repository and install it on your device. Now download the official firmware for your device. If you find factory image extract it and you will find another zip file in it. Open that file and extract <strong>boot.img</strong> file from it. If you don’t find factory image for your device download the OTA update file (if your vendor doesn’t provide it, Google is your best friend) once downloaded, extract <strong>payload.bin</strong> file the OTA and download payload-extractor from <a href="https://github.com/tobyxdd/android-ota-payload-extractor"><strong>here</strong></a> and extract <strong>boot.img</strong> file using this tool. Transfer the b<strong>oot.img</strong> to your phone. Now open magisk and select install, then select “Patch a image file” then locate your boot.img file and select it. Magisk will patch the boot.img file for you and save it to Downloads folder copy patched magisk boot.img file from your phone to your pc and reboot your device to bootloader</p><blockquote>user@localhost$ <strong>adb reboot bootloader</strong></blockquote><p>Once you are in bootloader use this command to unlock your bootloader</p><blockquote>user@localhost$ <strong>fastboot flashing unlock</strong></blockquote><p>or sometimes</p><blockquote>user@localhost: <strong>fastboot oem unlock</strong></blockquote><p>Use <strong>Volume buttons</strong> to switch between options and <strong>power button</strong> to select the option. This will wipe all the user data from your device. Setup your phone again and install <strong>magisk.apk</strong> again otherwise root will not be detected. Reboot your device again to bootloader (You can enable developer options again if you want). Now enter</p><blockquote>user@localhost$ <strong>fastboot flash boot Magisk_patched_boot.img</strong></blockquote><p>If you are not sure whether your device will be rooted correctly or not you can always test your <strong>patched boot.img</strong> for that use</p><blockquote>user@localhost$ <strong>fastboot boot Magisk_patched_boot.img</strong></blockquote><p>If your device booted successfully and everything is working fine reboot your device to bootloader and use the <strong>fastboot flash</strong> command so it will permanently root your device.</p><h3>What If???</h3><p>Now sometimes you may not find the factory image or OTA update file for your device what you should do in that situations?<br>HOLD ON!!! I got your back. That is why I mentioned TWRP in the start. Download TWRP for your specific device from the source I mentioned in the start. Once you have downloaded TWRP.img file place it on your computer. Once you have done this download magisk.apk too to your PC. Now, here is a trick rename magisk.apk to magisk.zip and transfer it to your phone and connect your device and reboot it in bootloader. You can do it either by using power and volume buttons combination (may differ from device to device so look accordingly) or the simplest way is to use adb command.</p><blockquote>user@localhost$ <strong>adb reboot bootloader</strong></blockquote><p>Once you are in bootloader enter this command to boot twrp</p><blockquote>user@localhost$ <strong>fastboot boot twrp.img</strong></blockquote><p>You will be booted into <strong>TWRP</strong> <strong>custom recovery</strong> if you had a password on your phone enter the password and you will see a menu like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*jQfM4Sm5YCHjc1TO.png" /><figcaption>image from: <a href="https://commons.wikimedia.org/">https://commons.wikimedia.org/</a></figcaption></figure><p>select install and now locate <strong>magisk.zip</strong> you placed in your phone. Select the <strong>magisk.zip</strong>. You will now see a screen like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jfNjEvbyVZQ1R5j2.jpg" /></figure><p>Now swipe the blue button across the bar and you are good to go once the process is complete. Simply restart your phone. First make sure that you have already installed <strong>magisk.apk</strong> (magisk manager) in your phone before doing this process otherwise your root will not be detected</p><p>If your phone doesn’t have a <strong>TWRP </strong>recovery too. Don’t lose hope there are still methods available but those methods are very tricky and you might end up hard bricking your phone. I will discuss those methods too but you have to take the risk.</p><p>Thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6276abc5e21" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>