You can reduce the amount of brute force quite significantly. Using an interval $d$ of approximately $\sqrt{c}$, make an "island" of values $a\cdot g^i$ with $i\in \{0,d{-}1\}$, then calculate all $g^{jd}$ and identify the coinciding value.
$\begin{array}{c|c}
k\ (d=4) &g^k & a\cdot g^k & b\cdot g^k \\ \hline
0 & 1 & 7 & 6 \\
1 & 3 & \color{red}{4} & \color{violet}{1} \\
2 & 9 & 12 & 3 \\
3 & 10 & 2 & 9 \\
4 & 13\\
8 & 16\\
12 & \color{red}{4}\\
16 & \color{violet}{1}\\
\end{array}$
giving, $\bmod 17$, $7\cdot 3\equiv 3^{12}$ and $6\cdot 3\equiv 3^{16}$ , so $7\equiv 3^{11}$ and $6\equiv 3^{15}$.
Then we need to find $11x\equiv 15 \bmod 16 (=\phi(17))$, which means finding the inverse of $11\bmod 16$, which here is $3$, giving $x\equiv 15\cdot 3 \equiv 13\bmod 16$.
Obviously for this exercise in small numbers this is more work thn simply calculating the powers of $7 \bmod 17$, but for larger numbers it avoids calculating all powers.
Because $3$ is a primitive root $\bmod 17$, we are guaranteed to find suitable exponents in the first stage.