OWASP Mobile Top 10 Vulnerabilities and Mitigation Strategies

According to Statista, there are 3.5 billion smartphone users. That means a lot of people could become victims of insecure mobile apps.

The OWASP Mobile Top 10 list is a great resource for app developers who want to create secure apps. That's because many mobile apps are inherently vulnerable to security risks. Let's think about some of the attacks on mobile apps that have occurred in the past few years. There was the WhatsApp Pegasus spyware that enabled attackers to control victims' devices. Another was the attack on the Pokémon Go app, where users could reverse-engineer the app to catch more Pokémon.

Top 10 APIs for Museums

It seems that almost every discipline imaginable is undergoing a digital transformation these days. That includes the art, science, and culture world of museums.

I have a problem in my C code.

So, basically this code is for a Tic Tac Toe game, I'm trying to make a Singleplayer mode where Player 1 inserts a spot number to put his X, and Player 2 uses a random number generating function and assigns his O in a random spot. Everything works fine except, Player 2's random number does not get assigned on the board.

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
char choice, choice2, modsel;
int player = 1, winner, end = 0, counter = 0, ran_num;

char arr[3][3] = {
  {'1','2','3'},{'4','5','6'},{'7','8','9'}
};
void numgen(int rannum) {
    srand(time(NULL));
    rannum = 1 + rand() % 9;
    ran_num = rannum;
}
void printarray() {
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            printf("|%c|", arr[i][j]);
        }
        printf("\n");
    }
}
void playingSP() {
    char letter;
    if (player == 1) {
        scanf("%c", &choice2);
        letter = 'x';
    }
    else if (player == 2) {
        numgen(ran_num);
        choice2 = ran_num;
        letter = 'o';
    }
    else {
        printf("wrong entry");
    }

    switch (choice2) {
    case '1': arr[0][0] = letter; break;
    case '2': arr[0][1] = letter; break;
    case '3': arr[0][2] = letter; break;
    case '4': arr[1][0] = letter; break;
    case '5': arr[1][1] = letter; break;
    case '6': arr[1][2] = letter; break;
    case '7': arr[2][0] = letter; break;
    case '8': arr[2][1] = letter; break;
    case '9': arr[2][2] = letter; break;
    }
    counter++;
}
void endgame() {
    for (int i = 0; i < 3; i++)
        if ((arr[i][0] == arr[i][1]) && (arr[i][1] == arr[i][2])) {
            if (arr[i][0] == 'x')
                winner = 1;
            else
                winner = 2;
            end = 1;
            return;
        }
    for (int j = 0; j < 3; j++)
        if ((arr[0][j] == arr[1][j]) && (arr[1][j] == arr[2][j])) {
            if (arr[0][j] == 'x')
                winner = 1;
            else
                winner = 2;
            end = 1;
            return;
        }
    if ((arr[0][0] == arr[1][1]) && (arr[1][1]) == arr[2][2]) {
        if (arr[0][0] == 'x')
            winner = 1;
        else
            winner = 2;
        end = 1;
        return;
    }
    if ((arr[0][2] == arr[1][1]) && (arr[1][1]) == arr[2][0]) {
        if (arr[0][2] == 'x')
            winner = 1;
        else
            winner = 2;
        end = 1;
        return;
    }
    if (counter == 8) {
        winner = 0;
        end = 1;
    }
}
int main()
{
    printarray();
    while (end != 1)
    {
        printf("player %d enter your number:", player);
        playingSP();
        printarray();
        endgame();
        if (player == 1)
            player = 2;
        else
            player = 1;
        playingSP();
    }
    if (winner == 0)
        printf("no winner\n");
    else
        printf("player %d won the game\n", winner);
    return 0;
}

Having issues generating non-used words for my hang man game.

I am creating a hangman game for my school summative. However I have been experiencing some difficulties with one of my methods called Random Words which performs a few tasks for my program including:

  • Generates a random word from a file which contains 6 different words
  • Does not generate the same random word twice. (this is part I'm having difficulties with).

This program works fine however it randomly stops in the middle returning secretWord as null even when there are still words left in my Words file.

Can anyone please help me please and thank you.

ps: A lot of people asked me why I have || secretWord==null in my do while statement and the reason I have that is because my program was giving me a null exception error and this prevents this from happening.
**

What I have tried:

public static String RandomWord() throws IOException {      
        FileReader fr = new FileReader ("./Hang Man File/Words.txt");           
        BufferedReader br = new BufferedReader(fr);                             
        int random = 0;
        String secretWord =" ";
        do {
            random =(int) ((int) 1+(Math.random()*6));
            for (int lineNo = 1; lineNo < 10; lineNo++) {
                if (lineNo == random) {
                     secretWord = br.readLine();
                } 
                else {
                    br.readLine();
                }
            }
        }
        while(usedWord.contains(secretWord) || secretWord==null); 

        usedWord.add(secretWord);
        return secretWord;
    }

Select information from the database for a page accessed by different users

This is the scenario:

User A: Access the website and choose a questionnaire. The questionnaires are separated on different pages in the same domain, for example:

Home: "surveys.com"

Questionnaires:

"surveys.com/type1"

"surveys.com/type2"

After choosing one, he (User A) puts the following information:

1 = Recipient's email

2 = His email

And then submit.

User B: Person who received this link to the questionnaire (surveys.com/type1).

What I want to do is: When User B accesses the link to the questionnaire page, it is already programmed to send responses to User A who left his email on the home page.

My idea was to save the information provided by User A in variables and save it in the database. When User B accesses the page, I take the respective information from the database and use it on the page to do what I want.

The problem is: How would I separate information for different users? (maybe it's simple, but I don't know how to do it)

That's what I've done so far:

Home:

<?php

include_once 'includes/dbh.php';
require  'email/PHPMailerAutoload.php';

$recipient = $_POST['emailFor'];
$sender = $_POST['senderEmail'];
$message = $_POST['message'];

$sql = "INSERT INTO users(email, body) VALUES('$sender', '$message');";
mysqli_query($conn, $sql;)

Questionnaire page (survey.com/type1):

<?php

include_once 'includes/dbh.php';
$sql = "SELECT * FROM users;";
$result = mysqli_query($conn, $sql);

?>

I think it is not possible to use sessions, since the information will need to be passed on to another user. I also thought about the possibility of creating a uniq link maybe, but I have no idea how to do it. Anyway, I'll be grateful if you can help with code examples for this.

A Utility Class for Covering Elements

Big ol’ same to Michelle Barker here:

Here’s something I find myself needing to do again and again in CSS: completely covering one element with another. It’s the same CSS every time: the first element (the one that needs to be covered) has position: relative applied to it. The second has position: absolute and is positioned so that all four sides align to the edges of the first element.

.original-element {
  position: relative;
}

.covering-element {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

I have it stuck in my head somehow that it’s “not as reliable” to use bottom and right and that it’s safer to set the top and left then do width: 100% and height: 100%. But I can’t remember why anymore—maybe it was an older browser thing?

But speaking of modernizing things, my favorite bit from Michelle’s article is this:

.overlay {
  position: absolute;
  inset: 0;
}

The inset property is a Logical Property and clearly very handy here! Read the article for another trick involving CSS grid.

Direct Link to ArticlePermalink


The post A Utility Class for Covering Elements appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Java dom inserting node hierarchy problem

hi there i have an XML file wich contain some music information in a node and i would like to insert more i would like to add more node on demeand when i do i receive this error HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. here is my XML structure

?xml version="1.0" encoding="UTF-8" standalone="no"?>
<playlist>
    <trackList>
        <track id="1">
            <location>C:\Music\subfoder\title.mp3</location>
            <creator>2Pac</creator>
            <title>Young Black Male</title>
            <album>2Pacalypse Now</album>
        </track>
        <--I WOULD LIE TO INSERT another node here track id ="2" -->
        </trackList>
        <--IN MANY THINGS I TESTED SOME INSERTED NODE HERE AND IT'S NOT WHAT I WANT-->
</playlist>

i use this code and i cant see what is the problem i have searcher all over internet couldn't any similar problem on forums or stack overflows.

public void addTrack(String playlistName) {
    String filePath = playlistName;
    File xmlFile = new File(filePath);
    DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();//nouvelle instace de Document DocumentBuilderFactory
    DocumentBuilder dBuilder;
    try{dBuilder = dbFactory.newDocumentBuilder();
    Document doc = dBuilder.parse(xmlFile);
    Node root = doc.getFirstChild();
    Node subroot =root.getFirstChild();
    int id = doc.getElementsByTagName("track").getLength()+1;
    subroot.appendChild(createMusicElement(doc, id,playlist.get(key).getLocation(), playlist.get(key).getTrack(), playlist.get(key).getAlbum(),playlist.get(key).getArtist()));
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    DOMSource source = new DOMSource(doc);
    StreamResult file = new StreamResult(filePath);
    transformer.transform(source, file);
    }catch (Exception e) {
        e.printStackTrace();
    }
}

thanks for your times i really apreciate!

Connecting 2 outers to the same CPU

Hi, the DSL had intermittent problem. The service provider came and fixed the problem.

As a result of the brief problem, my Netgear N600 WIFI Range Extender ceased connecting to the Internet via WIFI DSL modem (internet light won't turn on). I have done all the requirements including factory reset, power off, etc. to no avail. My other wireless devices(cell phones) which use to operate normally with the Netgear are unable to communicate to the Netgear either.

My Desktop CPU has only 1 Ethernet port which I currectly use to connect the CPU to the DSL. I am unable to connect the Netgear to the CPU as well.

Please advise. Thank you.