Can this batch file damage/prevent Windows 10 from booting?

Is there any chance, anything in the following batch could possibly delete/damage/corrupt any useful Windows 10 files (drivers, registry or other useful components), to the point of preventing them from even starting and causing a bootloop?

Caution: Don’t run this code as it might damage your system

takeown /f "H:PVR" /r
icacls "H:PVR" /reset /T
FOR /R "H:PVR" %%i IN (*.ts *.tsv) DO MOVE "%%i" "H:PVR"
ren *.tsv *.ts
for /f "delims=" %%d in ('dir /ad /b') do @rd /q /s "%%d"
setlocal EnableDelayedExpansion
for %%a in (*.ts *.tsv) do (
   set name=%%~Na
   set num=00!random!
   set newName=!!name:~-17!
   ren "%%a" "!newName!%%~Xa"

It’s a batch file I put together combining several commands found here and other places, in order to process .ts recodings from my DVBT-T2 receiver, stored in a flash drive.
The idea is to:

a). Take permission for the “H:PVR” and all its contents (the PVR folder in my flash drive).

b). Take the .tsv recordings out of the subfolders, then delete those subfolders.

c). Rename .tsv extension to .ts

d). Remove the first 17 characters from the filenames (cause I don’t like the prefix format of my receiver).

Please note I ran the batch file (as admin) both from the flash drive AND my C: drive, where Windows are installed. Then a CMD window opened and I saw filenames which are not in my flash drive being processed which was fishy….
My code skills are bad and I am trying to learn by adapting, but I never throught I could create a Frankenstein code that could do that. Please go ahead and tell me I’ve done something so foolish, I will be actually VERY HAPPY to hear so, because it’s the second time within 10 days that I am getting a nasty bootloop (no instant BSOD btw, but after running the bat file, ever since the next reboot, Windows won’t start and display “Critical Service Failed”), and I’ve been trying hard to troubleshoot it, to no avail. Bonus points for letting me know what’s the mistake and how to correct it, but just letting me know whether it could be responsible is also absolutely fine!

Please tell me it’s not a coincidence. Thank you.

command line – How can I make a file with alias’s on it, put it on usb stick, and make the alias’s accesible when I insert the usb drive

Hi Im very new to ubuntu and linux, I know how to create the file and put alias’s on it, I was wondering how do I make this file accesible only when I insert the usb drive,meaning the alias’s would work only when the usb drive is connected, should I Add the usb drive path to bashrc? Im very confused, any help would be nice.

docker – Cannot gather stats and Invalid template file after installing Porto theme

After setting up Magento 2 in developer mode, I am getting a couple of errors:

(2021-04-19 21:39:09) report.INFO: Broken reference: the 'yotpo_bottomline' tries to reorder itself towards '', but their parents are different: '' and '' respectively. () ()
(2021-04-19 21:39:09) report.CRITICAL: Cannot gather stats! Warning!stat(): stat failed for /app/pub/static/frontend/Magento/luma/en_US/mage/requirejs/mixins.js {"exception":"(object) (Magento\Framework\Exception\FileSystemException(code: 0): Cannot gather stats! Warning!stat(): stat failed for /app/pub/static/frontend/Magento/luma/en_US/mage/requirejs/mixins.js at /app/vendor/magento/framework/Filesystem/Driver/File.php:95)"} ()
(2021-04-19 21:39:10) report.CRITICAL: Invalid template file: 'owl_list.phtml' in module: 'Smartwave_Filterproducts' block's name: 'homefeaturedlist_0' {"exception":"(object) (Magento\Framework\Exception\ValidatorException(code: 0): Invalid template file: 'owl_list.phtml' in module: 'Smartwave_Filterproducts' block's name: 'home\featuredlist_0' at /app/vendor/magento/framework/View/Element/Template.php:280)"} ()
(2021-04-19 21:39:10) report.CRITICAL: Invalid template file: 'grid.phtml' in module: 'Smartwave_Filterproducts' block's name: 'homefeaturedlist_1' {"exception":"(object) (Magento\Framework\Exception\ValidatorException(code: 0): Invalid template file: 'grid.phtml' in module: 'Smartwave_Filterproducts' block's name: 'home\featuredlist_1' at /app/vendor/magento/framework/View/Element/Template.php:280)"} ()

I followed the Magento 2 documentation to install Magento in docker. Then, in an attempt to follow the Porto docs, I copied the Porto theme files, the theme patch for Magento 2.2.x, theme patch for Magento 2.3.x, and the theme patch for Magento 2.4.1.

Any help on resolving the above errors would be appreciated.

file upload – Is checking zip content on another PC enough to prevent data leak?

Is checking archive content (by previewing or extracting it) on another PC enough to prevent possible leaks?

Is it enough to be 100% sure – No, since the software used to extract might have bugs too. Or the original software might have added the data accidentally at some place in the ZIP file where they don’t get extracted but are still visible when looking at the file through other means.

Does it reduce the risk – Yes.

Does it reduce the risk enough – Depends on what you consider enough.

java – Counting the number of unique IP addresses in a very large file. Follow-Up #1

It’s a follow-up question.
A previous version
of this code has been posted on Code Review about 2 weeks ago.

What was done after the last review

In fact, the entire application is rewritten from scratch. Here
is current version with tests and JavaDoc.

I tried to split the application into small classes that have only one responsibility and can be re-used and extended.

The main approach to solve a problem has not changed. I still put one value in accordance with each ip and set a bit with the corresponding index in the bit array. The required amount of memory remained the same about 550-600 MB. The speed has increased, now I am practically limited to the performance of my hard disk. It is still assumed that only valid IPs will be in the file.

I deleted all JavaDoc comments from code examples, because they occupy more space than the code itself.


I wrote a simple implementation of the bit array that allows you to store N bits with indexes from 0 to N-1. There are
three operations are supported: set bit, examine bit’s value, and get the number of all the set bits.
getCapacity() method used for testing and may be useful in other cases.

I do not bring the BitVector interface due to its primitiveness and simplicity.


public class FixedSizeBitVector implements BitVector {

    public static final long MIN_CAPACITY = 1L;
    public static final long MAX_CAPACITY = 1L << 32;

    private final long capacity;
    private final int() intArray;
    private long cardinality;

    public FixedSizeBitVector(long capacity) {
        if (capacity < MIN_CAPACITY || capacity > MAX_CAPACITY) {
            throw new IllegalArgumentException("Capacity must be in range (1.." + MAX_CAPACITY + ").");
        int arraySize = 1 + (int) ((capacity - 1) >> 5);
        this.intArray = new int(arraySize);
        this.capacity = capacity;

    private void checkBounds(long bitIndex) {
        if (bitIndex < 0 || bitIndex >= capacity) {
            throw new IllegalArgumentException("Bit index must be in range (0.." + (capacity - 1) + ").");

    public void setBit(long bitIndex) {
        int index = (int) (bitIndex >> 5);
        int bit = 1 << (bitIndex & 31);
        if ((intArray(index) & bit) == 0) {
            intArray(index) |= bit;

    public boolean getBit(long bitIndex) {
        int index = (int) (bitIndex >> 5);
        int bit = 1 << (bitIndex & 31);
        return (intArray(index) & bit) != 0;

    public long getCapacity() {
        return capacity;

    public long getCardinality() {
        return cardinality;


This class implements the counter of unique lines in the input Iterable<String> sequence. The counter uses BitVector
implementation. To work, it is required that the input sequence has a final number of possible string-values and this
amount did not exceed the maximum capacity of the bit vector used.

It also requires a hash function that puts a String and a long in an unambiguous match.


import javax.validation.constraints.NotNull;
import java.util.Objects;
import java.util.function.ToLongFunction;

public class UniqueStringCounter {

    private final Iterable<String> lines;
    private final ToLongFunction<String> hashFunction;
    private final BitVector bitVector;
    private long linesProcessed;

    public UniqueStringCounter(@NotNull Iterable<String> lines,
                               long capacity,
                               @NotNull ToLongFunction<String> hashFunction) {

        this.lines = lines;
        this.hashFunction = hashFunction;
        this.bitVector = new FixedSizeBitVector(capacity);

    public long count() {
        for (String line : lines) {
            long value = hashFunction.applyAsLong(line);
        return bitVector.getCardinality();

    public long getLinesProcessed() {
        return linesProcessed;


Hash function to convert a String to a long value. This function must generate a unique value for each unique line,
the collisions are not allowed.

I tested several options for the conversion of IP-String in the long-value and came to the conclusion that they all work around at the same speed that the InetAddress. I do not see the reasons to write my own implementation when the speed of the library function is completely satisfied.

The processing of exceptions really is not needed here, because according to the terms of the task, I am guaranteed that there will be only valid IP. I had to make this processing since otherwise I can’t use this function as a parameter for UniqueStringCounter.


import java.util.function.ToLongFunction;

public class IpStringHashFunction implements ToLongFunction<String> {

    public long applyAsLong(String value) {
        long result = 0;
        try {
            for (byte b : InetAddress.getByName(value).getAddress())
                result = (result << 8) | (b & 255);
        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        return result;


A simple adapter that allows you to work with BufferedReader as with Iterable. I could not come up with a better way
to send the contents of the file in UniqueStringCounter, which expects to the Iterable<String> as parameter.


import javax.validation.constraints.NotNull;
import java.util.Iterator;
import java.util.Objects;

public class BufferedReaderIterable implements Iterable<String> {

    private final Iterator<String> iterator;

    public BufferedReaderIterable(@NotNull BufferedReader bufferedReader) {
        iterator = new BufferedReaderIterator(bufferedReader);

    public Iterator<String> iterator() {
        return iterator;

    private static class BufferedReaderIterator implements Iterator<String> {

        private final BufferedReader bufferedReader;

        private BufferedReaderIterator(BufferedReader bufferedReader) {
            this.bufferedReader = bufferedReader;

        public boolean hasNext() {
            try {
                return bufferedReader.ready();
            } catch (IOException e) {
                throw new RuntimeException(e);

        public String next() {
            String line;
            try {
                line = bufferedReader.readLine();
                if (line == null) {
                    try {
                    } catch (IOException e) {
                        throw new RuntimeException(e);
            } catch (IOException e) {
                throw new RuntimeException(e);
            return line;


The main class of the application. Accepts the file name in the -file parameter.


import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;

public class IpCounterApp {

    private static String parseFileName(String() args) {
        Objects.requireNonNull(args, "No arguments found. Use -file file-name to processing file.");
        if (args.length == 2 || "-file".equals(args(0))) {
            return args(1);
        return null;

    public static void main(String() args) {
        String fileName = parseFileName(args);
        if (fileName == null) {
            System.err.println("Wrong arguments. Use -file file-name to processing file.");

        Path filePath = Paths.get(fileName);
        if (!Files.exists(filePath)) {
            System.err.printf("File %s does not exists.n", filePath);

        try {
            System.out.printf("Processing file: %sn", filePath);
            long startTime = System.nanoTime();
            BufferedReader bufferedReader = Files.newBufferedReader(filePath);
            Iterable<String> strings = new BufferedReaderIterable(bufferedReader);
            UniqueStringCounter counter = new UniqueStringCounter(strings, 1L << 32, new IpStringHashFunction());
            long numberOfUniqueIp = counter.count();
            long linesProcessed = counter.getLinesProcessed();
            long elapsedTime = System.nanoTime() - startTime;
            System.out.printf("Unique IP addresses: %d in total %d.n", numberOfUniqueIp, linesProcessed);
            System.out.printf("Total time: %d milliseconds.n", elapsedTime / 1_000_000);
        } catch (IOException e) {

Why do I ask the new Review?

In previous question
I received a few excellent answers and one excellent bug report. I tried to take into account so many comments as I
could. I also tried to reconsider my approach to the design of classes. I am interested in mostly three questions:

  • How are my new classes are suitable for re-use and extension? What other abstractions can be allocated here and should
    it be done?
  • What should I do with error processing? I know that now it is bad. I just try to fall as early as possible.
  • And most importantly. Do I move in the right direction? I am a newbie in programming and get an overview for my code is
    the only way to learn how to write a quality and understandable code.

virus – Could just downloading (not opening) .tgz file infect Windows 10?

Today I received some e-mail to Thunderbird. It had image attached that I clicked:

enter image description here

Which sent me to… and automatically downloaded .tgz file. I am not even sure if the file was really .tgz or it was fake extension. I didn’t open the file, but Windows still made some preview inside download folder:

enter image description here

Is there risk that my laptop is infected even if I didn’t open the file and I just deleted it? Could I get infected because Windows made automatic preview without opening the file?

user interface – Powershell: GUI input to text file

I’ve created an input box with PowerShell. When I want to save the input to a text file I get this in the text file:

path=System.Windows.Forms.TextBox, Text: MYINPUTTEDTEXT.text

Code to output the text:

$PSDefaultParameterValues['Out-File:Encoding'] = 'ascii'
write-output "path=$textinput" >> User-Generatedpreferences.ini

But I would like to have only:


Thanks for your help!


exploit – VirtualBox: Making a Keylogger file from Kali VM after exploiting Metasploitable (Bridged Adapter)

I am fairly new to Kali Linux and Metasploitable and I am trying to set a Key Logger for when i gain root access to Metasploitable from Kali Linux. I have gained root access by using the use exploit/unix/irc/unreal_ircd_3281_backdoor (I followed everything from here and have successfully penetrated Metasploitable. However, I am using a Bridged Adapter network to make this work and I would like to use a Keylogger that is already downloaded into Kali Linux rather than use wget as I have no access to the internet from Kali Linux.

I am following off this tutorial and he has made the code into a Drop Box link, however i would like to use the downloaded file that is already on Kali Linux.

If there is a easier way to do a Key Logger from Kali VM after exploiting Metasploit, please do not be afraid to suggest it. Thank you