Friday, June 23, 2017

formatting - Format PC without losing Windows 7 license






I have a windows 7 intallation that I got from MSDN. The thing is that I want to format my PC and reinstall windows 7.


At first I thought I just have to write the current key somewhere, reinstall windows 7 normally and then activate it with my old key, but a friend did this and on the last step the activation wouldn't work because it said that the key was in use.


What can I do?


Answer



It may work just fine but if not, you simply need to call the Microsoft number the activation tool will give you and explain the format and reinstall. Takes a few minutes.


Thursday, June 22, 2017

Wednesday, June 21, 2017

networking - How to block all traffic but one IP in windows firewall using command line

I have a project and for it I need to only allow connections in from a certain subnet, everything else must be dropped. The catch is that its all going to be automated, no user interaction, there for the other answers showing how to use the GUI in windows are no good. I have a Python script that runs the windows shell command (netsh advfirewall...) that makes all the rules I want, however if I add a block all rule it overwrites all my allow rules. I tried adding it first as well as last on the list of rules, I'm not sure what I'm doing wrong. Attached are my commands/rules




import subprocess

#allow connections over port 80 and 443 tcp
subprocess.call('netsh advfirewall firewall add rule name="allow port 80 tcp in" dir=in localport=80 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 80 tcp out" dir=out localport=80 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 443 tcp in" dir=in localport=443 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 443 tcp out" dir=out localport=443 protocol=tcp action=allow', shell=True)

#allow icmt v4/v6 in/out

subprocess.call('netsh advfirewall firewall add rule name="allow port icmpv4 in" dir=in protocol=icmpv4 action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port icmpv6 in" dir=in protocol=icmpv6 action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port icmpv4 out" dir=out protocol=icmpv4 action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port icmpv6 out" dir=out protocol=icmpv4 action=allow', shell=True)

#allow ssh (port 20) via specific subnets
subprocess.call('netsh advfirewall firewall add rule name="allow port 20 in" dir=in localport=20 remoteip =10.0.0.0/8 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 20 in" dir=in localport=20 remoteip =192.168.0.0/16 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 20 in" dir=in localport=20 remoteip =172.0.0.0/8 protocol=tcp action=allow', shell=True)


subprocess.call('netsh advfirewall firewall add rule name="allow port 20 out" dir=out localport=20 remoteip =10.0.0.0/8 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 20 out" dir=out localport=20 remoteip =192.168.0.0/16 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 20 out" dir=out localport=20 remoteip =172.0.0.0/8 protocol=tcp action=allow', shell=True)

#allow rdp (port 3389) via specific subnets

subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 in tcp" dir=in localport=3389 remoteip =10.0.0.0/8 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 in tcp" dir=in localport=3389 remoteip =192.168.0.0/16 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 in tcp" dir=in localport=3389 remoteip =172.0.0.0/8 protocol=tcp action=allow', shell=True)


subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 out tcp" dir=out localport=3389 remoteip =10.0.0.0/8 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 out tcp" dir=out localport=3389 remoteip =192.168.0.0/16 protocol=tcp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 out tcp" dir=out localport=3389 remoteip =172.0.0.0/8 protocol=tcp action=allow', shell=True)

subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 in udp" dir=in localport=3389 remoteip =10.0.0.0/8 protocol=udp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 in udp" dir=in localport=3389 remoteip =192.168.0.0/16 protocol=udp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 in udp" dir=in localport=3389 remoteip =172.0.0.0/8 protocol=udp action=allow', shell=True)

subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 out udp" dir=out localport=3389 remoteip =10.0.0.0/8 protocol=udp action=allow', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 out udp" dir=out localport=3389 remoteip =192.168.0.0/16 protocol=udp action=allow', shell=True)

subprocess.call('netsh advfirewall firewall add rule name="allow port 3389 out udp" dir=out localport=3389 remoteip =172.0.0.0/8 protocol=udp action=allow', shell=True)

#Block all connections
subprocess.call('netsh advfirewall firewall add rule name="block all inbound" dir=in protocol=any action=block', shell=True)
subprocess.call('netsh advfirewall firewall add rule name="block all outbound" dir=out protocol=any action=block', shell=True)

ntfs - Laptop HDD fail, Shows partition but can not copy data, testdisk MBR code fail

I use 2TB HDD in my laptop with 250 GB partition for windows 10 and rest for data storage. I switched my laptop so moved the HDD from old to new laptop and started the system. Windows logo came up but within a minute laptop crashed and then after nothing worked. I took out the HDD and plugged externally to another windows 10 system where it shows both the partition mounted with their respective sizes. When I open the drive it shows folders as well but when I open or copy any of the folder it gives error "The device is not ready".


I tried using minitool and recuva data recovery but it failed to detect anything.


Then I plugged the HDD externally to Ubuntu system. Gparted shows 3 partitions, 1) ntfs system reserved 549 MiB, 2) ntfs Windows 250 GiB, 3) ntfs 1.57 TiB. But the direct data copy or testdisk fails.


I used testdisk to analyse lost partitions but nothing is reported, even in deep search. I then used the MBR code but even that failed.


I also used gddrescue to copy image the entire disk which ran for ~ 24 hours and made the image file of 800 GB. Following is the output of log:


# Rescue Logfile. Created by GNU ddrescue version 1.19
# Command line: ddrescue /dev/sdb /media/v/Seagate Backup Plus Drive/copy.img /media/v/Seagate Backup Plus Drive/status.log
# Start time: 2018-11-29 12:16:31
# Current time: 2018-11-30 11:33:28
# Copying non-tried blocks... Pass 1 (forwards)
# current_pos current_status
0xC21A8B0000 ?
# pos size status
0x00000000 0xBF655E0000 +
0xBF655E0000 0x00010000 *
0xBF655F0000 0x00010000 ?
0xBF65600000 0x7F078000 +
0xBFE4678000 0x00008000 *
0xBFE4680000 0x00010000 ?
0xBFE4690000 0xA9DC0000 +
0xC08E450000 0x00010000 *
0xC08E460000 0x00010000 ?
0xC08E470000 0xDDADC000 +
0xC16BF4C000 0x00004000 *
0xC16BF50000 0x00010000 ?
0xC16BF60000 0xAE950000 +
0xC21A8B0000 0x2E166F25E00 ?

I have important data in Data partition so I do not want to take risky steps. So I am now posting this question for help.


Update 20181201
I ran ddrescue and following is the current status.
ddrescue status


Any idea why the recent blocks are full of errors? I see a trend that somewhere in middle many red block are coming? Could it be that the rest of the blocks will follow the same trend henceforth? How do I see which files have been rescued in the green area?


Kindly suggest how to rescue the data on the disk.


Thanks a lot in advance.

battery - plugged in, not charging

My acer aspire r7 won't charge and it states "plugged in, not charging." Looks like this is a fairly common problem people are having. I have tried many suggested solutions that I I found researching and nothing has worked yet.



There is the "12 step" solution which seems promising:




  1. Disconnect AC adapter

  2. Shutdown Windows 8

  3. Remove battery

  4. Connect AC Adapter

  5. Power on the laptop


  6. Open the Control Panel and select Device Manager

  7. Under the Batteries category, right-click all instances of Microsoft ACPI Compliant Control Method Battery , and select Uninstall, even if you have only one (I had two, as shown in figure 1 below)

  8. Shutdown

  9. Disconnect AC adapter

  10. Insert battery

  11. Connect AC adapter

  12. Power on the laptop



The problem for me with this solution is step 3 which requires you to remove battery and my laptop has an internal battery. I tried doing all the other steps and no luck. Any suggestions would be very much appreciated. Thanks so much, Abbi

memory - Why PCs need much more RAM than video game consoles to run the same games?



It seems strange to me that every 7th generation console has much less memory than contemporary PCs, but games on consoles still run pretty smooth today.



For example:
PS3 has 256 MB memory for system and 256 MB memory for video.
Xbox 360 has 512 MB of GDDR3 RAM clocked at 700 MHz.
And, this is really strange, Wii has only 24 MB of video RAM and 64 MB GDDR3 system RAM.




But if you try to run GTA 4 on the PC with 256 MB of system RAM, even with 256 MB RAM on the video card, well, let's just say it won't work that way.



Why?


Answer



Let's do some comparisons...




PS3 has 256 MB memory for system and 256 MB memory for video. Xbox 360 has 512 MB of GDDR3 RAM clocked at 700 MHz. And, this is really strange, Wii has only 24 MB of video RAM and 64 MB GDDR3 system RAM.





Graphics on Wii games are usually kept simple, you won't see shiny graphics there apart from the nice intro to Mario & Sonic's introduction screen. Although that's just a video playing back, cheap...



If you don't believe me, this comparison shows it clearly.





A Visual Comparison Of Modern Warfare's Wii Debut And The Original



It doesn't seem easy to find other clear comparisons, the image search results are overloaded with results of the same game, the Wii U or pictures too small to tell the difference; you're always welcome to add another picture, but the Wii game console has yet to surprise me.




For the PS 3 vs XBOX 360, you clearly see a difference in texture.





Developers Speaking Out on the PS3



As for XBOX 360 vs PC, the difference lies in the resolution, textures and more...






Risen releases February on 360, will be proper port



Is it all about the memory?



No, certainly not. How fast the GPU can perform in terms of fill rate and shading also plays a huge role; this is why the XBOX 360 outperforms the PS 3, as they have the same amount of memory.



All those factors involved in the specifications contribute to being able to do effects like bloom, drawing things further in the distance, do better bump mapping and lightning, having even better AA and more...



Sometimes this takes a second look at the photo to actually see the difference, most often you can't always tell this due to compression of the picture (or YouTube video) such that it doesn't represent the actual graphics in the game.




Similarly, you can get a PC with a ton of memory, but have a card that can't even play a game at 720p.



It's about how much you can put into it for the price.



Let's say price wouldn't matter, well, we'd have something like the Fastra II.





That's right, we're looking at six NVIDIA GTX295 dual-GPU cards, and one GTX275 single-GPU card. That's 13 GPUs total! That's why it outperforms a typical GPU 12 times.






Although, well, yeah; this set-up requires some software / driver optimization to suffice for gaming.



To address the question... Do PCs need much more RAM?



Not necessarily, one could build a machine with a light-weight Linux kernel, light-weight X and perhaps wine as well (unless the game has native support); as a result you'll end up with barely any space taken by the Linux kernel and most space available to the game, then, you get the hardware with the same memory limits as the console, turn down the game graphics and actually have PS3 / XBOX 360 like graphics. I have no clue whether the Wii specs could be achieved, but most games on the Wii aren't available for computer architectures anyway (ignoring emulation).



The PC itself doesn't impose more memory, it's what the environment your game runs in does.



windows vista - How can I reduce the size of the Winsxs folder without damaging anything?






This folder has grown to over 12GB and continues growing in size. Is there any way to clean it up without damaging the installed programs or Vista?


Answer



This folder is essential for all the programs that you have installed. To prevent the "DLL hell", Windows copies required DLLs for every single installed program here. This way, installed programs do not influence each other. It is very common for this folder to grow over 10 GB and beyond.


Try uninstalling some unneeded programs, see if that helps. If you want to keep the folder small, reinstall your Windows and install as few additional programs as possible. But that maybe defies the purpose of having a personal computer at all.


So in short: it is a necessary evil to live with. It is a price we pay for compatibility.


hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...